-
-
-
reviewboard/reviews/builtin_fields.py (Diff revision 1) We should be using
format_html
. Would also be nice to use dictionary args for formatting. -
-
-
-
-
reviewboard/static/rb/js/views/reviewRequestEditorView.js (Diff revision 1) Blank line between these.
-
reviewboard/templates/reviews/review_request_box.html (Diff revision 1) How about
post_field_html
instead ofextra_html
? Would be nice to be explicit there, in case we decide to allow for custom HTML before the<span>
.
Add a feature to automatically suggest reviewers for a given review request
Review Request #5740 — Created April 25, 2014 and submitted
This change is, for the most part, the same as Natasha's change at /r/5029. I had to port it over to the new fields code, and make a handful of other small changes to get it to work.
My plan is to push this to a branch off master, where we can play with it and do some performance testing.
Description | From | Last Updated |
---|---|---|
""" on the next line. |
|
|
We should be using format_html. Would also be nice to use dictionary args for formatting. |
|
|
Should use format_html here too. |
|
|
Should use single quotes. |
|
|
Swap these. |
|
|
Blank line after this. |
|
|
Blank line between these. |
|
|
How about post_field_html instead of extra_html? Would be nice to be explicit there, in case we decide to allow for … |
|
|
If we don't mind a little extra '/' stripping, this can be: diffed_files = [ fd.source_file.lstrip('/') for fd in diffset.files.all() … |
|
|
Alignment looks weird. |
|
|
Let's swap these conditions. rr_id != self.pk is a faster check. |
|
|
This can be: user, user_timestamp, related_review_request = all_reviews[rev] |
|
|
I don't know if it's faster to use six.iteritems here, but since this will be the equivalent of iteritems on … |
|
|
This is formatted awkwardly. How about: sorted_users = [ user for user, weight in ... ] |
|
|
Can we pull out .suggest-user once, instead of re-querying every time? |
|
|
With the exception of selector above, all of these are in alphabetical order. Can we move these (and selector) to … |
|
|
Should just use a pre-fetched element. |
|
|
This looks to be doing too much. If we kept this logic, then this could just be: this._$suggestedPeople .empty() .append($allPeople); … |
|
|
We fetch all the diffsets in review_detail. It'd be nice to make use of those to grab the latest, if … |
|
|
Col: 80 E251 unexpected spaces around keyword / parameter equals |
![]() |
|
This terrifies me still. It's a large join. We should do some testing against large MySQL databases before this goes … |
|
|
Col: 26 E127 continuation line over-indented for visual indent |
![]() |
|
Col: 80 E501 line too long (80 > 79 characters) |
![]() |
|
list comprehension redefines 'user' from line 195 |
![]() |
|
list comprehension redefines 'weight' from line 206 |
![]() |
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+226 -5) |
-
-
reviewboard/reviews/models/base_review_request_details.py (Diff revision 2) If we don't mind a little extra '/' stripping, this can be:
diffed_files = [ fd.source_file.lstrip('/') for fd in diffset.files.all() ]
-
reviewboard/reviews/models/base_review_request_details.py (Diff revision 2) Don't we have some normalization somewhere now for this?
-
-
reviewboard/reviews/models/base_review_request_details.py (Diff revision 2) Let's swap these conditions.
rr_id != self.pk
is a faster check. -
reviewboard/reviews/models/base_review_request_details.py (Diff revision 2) This can be:
user, user_timestamp, related_review_request = all_reviews[rev]
-
reviewboard/reviews/models/base_review_request_details.py (Diff revision 2) I don't know if it's faster to use
six.iteritems
here, but since this will be the equivalent of iteritems on Python 3.x, we might as well use it for 2.x for consistency. -
reviewboard/reviews/models/base_review_request_details.py (Diff revision 2) This is formatted awkwardly. How about:
sorted_users = [ user for user, weight in ... ]
-
reviewboard/static/rb/js/views/reviewRequestEditorView.js (Diff revision 2) Can we pull out
.suggest-user
once, instead of re-querying every time? -
reviewboard/static/rb/js/views/reviewRequestEditorView.js (Diff revision 2) With the exception of
selector
above, all of these are in alphabetical order. Can we move these (andselector
) to be consistent in that way? -
reviewboard/static/rb/js/views/reviewRequestEditorView.js (Diff revision 2) Should just use a pre-fetched element.
-
reviewboard/static/rb/js/views/reviewRequestEditorView.js (Diff revision 2) This looks to be doing too much. If we kept this logic, then this could just be:
this._$suggestedPeople .empty() .append($allPeople);
However, I'm not really sure why we need to do all this work. I wasn't sure why we were, but I suspect it's because we insert those ',' characters. If so, we're just doing way too much work here.
What I'd suggest is not doing any of this, and instead just list the visible users as standard elements. Then, in CSS, we can do something like:
.suggest-user:after { content: ", " } .suggest-user:last-child:after { content: "" }
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+207 -5) |

-
Tool: Pyflakes Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/models/base_review_request_details.py reviewboard/reviews/fields.py Ignored Files: reviewboard/templates/reviews/review_request_box.html reviewboard/static/rb/css/pages/reviews.less reviewboard/static/rb/js/views/reviewRequestEditorView.js Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/models/base_review_request_details.py reviewboard/reviews/fields.py Ignored Files: reviewboard/templates/reviews/review_request_box.html reviewboard/static/rb/css/pages/reviews.less reviewboard/static/rb/js/views/reviewRequestEditorView.js
-
reviewboard/reviews/models/base_review_request_details.py (Diff revision 3) Col: 80 E251 unexpected spaces around keyword / parameter equals
-
reviewboard/reviews/models/base_review_request_details.py (Diff revision 3) Col: 26 E127 continuation line over-indented for visual indent
-
reviewboard/reviews/models/base_review_request_details.py (Diff revision 3) Col: 80 E501 line too long (80 > 79 characters)
-
reviewboard/reviews/models/base_review_request_details.py (Diff revision 3) list comprehension redefines 'user' from line 195
-
reviewboard/reviews/models/base_review_request_details.py (Diff revision 3) list comprehension redefines 'weight' from line 206
-
-
reviewboard/reviews/models/base_review_request_details.py (Diff revision 3) We fetch all the diffsets in review_detail. It'd be nice to make use of those to grab the latest, if available, to reduce a query.
I'm very concerned about the impact this feature will have to load times, so any query reduction we can do is very important.
-
reviewboard/reviews/models/base_review_request_details.py (Diff revision 3) This terrifies me still. It's a large join. We should do some testing against large MySQL databases before this goes in. I'd like to see whether it's faster to do a large join, or to split it into a couple different queries.
One thought on optimization:
We're going to fetch a lot of user data, and a lot of it may be the same data. Instead of grabbing 'user', let's just grab the ID, and then after we dedup later, we can fetch the data we need from those user IDs. Same for the
reviews__user
.