[PATCH 02/11] 4x performance improvement for viewing patch with many comments

Stewart Smith stewart at linux.ibm.com
Mon Sep 10 12:25:01 AEST 2018

Stephen Finucane <stephen at that.guru> writes:
> On Fri, 2018-08-10 at 18:00 +1000, Stewart Smith wrote:
>> Using the example of id:20180720035941.6844-1-khandual at 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 at linux.ibm.com>
> Looks good to me. Daniel's already pointed out the comma-space thing
> (blame pep8) but we'll fix at merge time.
> Reviewed-by: Stephen Finucane <stephen at that.guru>
> I think the learning here, and for other, related patches in the
> series, is that we should be more careful using any model relationships
> in templates.

Yeah, that was a bit of a theme for some of the performance things I was
looking at.

Stewart Smith
OPAL Architect, IBM.

More information about the Patchwork mailing list