Merge lp://staging/~gary/launchpad/bug724025 into lp://staging/launchpad

Proposed by Gary Poster
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: 13772
Proposed branch: lp://staging/~gary/launchpad/bug724025
Merge into: lp://staging/launchpad
Diff against target: 522 lines (+144/-162)
5 files modified
lib/lp/bugs/browser/bugtask.py (+72/-81)
lib/lp/bugs/browser/configure.zcml (+1/-2)
lib/lp/bugs/templates/bugtask-tasks-and-nominations-table-row.pt (+66/-74)
setup.py (+1/-2)
versions.cfg (+4/-3)
To merge this branch: bzr merge lp://staging/~gary/launchpad/bug724025
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+72484@code.staging.launchpad.net

Commit message

[incr] [r=gmb][bug=724025] Speed up an inner loop for BugTask:+index with many tasks.

Description of the change

This branch takes the previous work to reduce the Python cost of many tasks on the BugTask:+index page and extends it a bit more. This time, we optimize the inner loop of rendering many tasks by calculating the shared data for the view carefully at initialization, and by using a Chameleon template for the rendering.

Note that this code has *no* SQL queries while the inner loop is run, thanks to previous work by Robert. This is entirely rendering time.

The initialization saves a bit less than half a second on my system with 160/320 bugtasks (the doubled number represents the parent bugtask for a sourcepackage). Hopefully it is fairly straightforward to read: I collect the data, and then the template is simplified a bit.

The switch to Chameleon is even less to read. It also saves around half a second in the conditions I described above. You might know that I disabled Chameleon earlier for ++profile++. The new version does not write compiled files to disk by default. While I would prefer it to do this in the future, it is simpler to do what I have done here. The first time BugTask:+index is rendered, a bit of time will be spent to calculate the bytecode for the template; subsequently, the cost will be gone until the process restarts.

There are no tests, because it is existing functionality, and we already were not generating SQL in the inner loop.

Lint is happy.

To QA, go to any BugTask:+index page. The first time a +index page is rendered for that process, it will be a bit slower, as described above. Subsequently, you should have a modest speed gain.

This bug will get one or two more changes before I move on. Minimally, I plan to make only the first 50 bugtasks render initially, with the current context bugtask at the top, and then JS to render the remaining tasks on demand. Ideally, I'll also address an unrelated aspect of why this page is slow: we need to pre-load associated branches, using code that Danilo worked on in another branch.

Thank you

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) :
review: Approve (code)
Revision history for this message
Gary Poster (gary) wrote :

This should have been [incr]. :-/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.