]> git.ipfire.org Git - thirdparty/patchwork.git/commit
4x performance improvement for viewing patch with many comments
authorStewart Smith <stewart@linux.ibm.com>
Fri, 10 Aug 2018 08:00:57 +0000 (18:00 +1000)
committerStephen Finucane <stephen@that.guru>
Fri, 31 Aug 2018 13:43:19 +0000 (14:43 +0100)
commitcf0826376911b22c846881e3f455b9592d7bda48
treea838d66f9b7ef4fe7a2a8d4d40ab360551aed6d5
parent4030aacf0ab01fbb13fd5586d5d4b11eaeac2435
4x performance improvement for viewing patch with many comments

Using the example of id:20180720035941.6844-1-khandual@linux.vnet.ibm.com
with my test dataset of a chunk of a variety of mailing lists, has
this cover letter have 67 comments from a variety of people. Thus,
it's on the larger side of things.

Originally, displaying the /patch/550/ for this (redirected to /cover)
would take 81 SQL queries in ~60ms on my laptop.

After this optimisation, it's down to 14 queries in 14ms.

When the cache is cold, it's down to 32ms from 83ms.

The effect of this patch is to execute a join in the database to
get the submitter information for each comment at the same time as
getting all the comments rather than doing a one-by-one lookup after
the fact.

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
patchwork/templates/patchwork/submission.html
patchwork/views/cover.py
patchwork/views/patch.py