Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Issue 565753002: Make Courgette as much as 5x faster. (Closed)

Created:
6 years, 3 months ago by Alexei Svitkine (slow)
Modified:
6 years, 3 months ago
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Make Courgette as much as 5x faster. Changes the Courgette vector implementation to slightly over-reserve the size of the vector, which makes many future reserve operations no-ops (as they're quite expensive otherwise, since they copy the full contents of the previous buffer). When applying the patch from 35.0.1916.114 to 37.0.2062.120, before and after this change, the runtime goes from 1m10s to 21s on my z620. Slightly higher multipliers produce even better results (e.g. 19s), but this seemed like a reasonable value to chose so that it doesn't result in significant additional memory use by Courgette. BUG=167622 TEST=Build courgette target in Release mode and run it as courgette.exe -apply chrome.7z chrome_patch.diff out.7z (where chrome.7z was from un7zipping a 37.0.2062.94 chrome installer and chrome_patch.diff was from un7zipping a 37.0.2062.94 -> 37.0.2062.120_37 chrome_updater_3stage.exe). With the patch, the operation should run ~5x faster. Committed: https://crrev.com/53523269bac5a15fb94da76a879ca3445f096a42 Cr-Commit-Position: refs/heads/master@{#294592}

Patch Set 1 : #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -0 lines) Patch
M courgette/memory_allocator.h View 1 chunk +6 lines, -0 lines 2 comments Download

Messages

Total messages: 26 (4 generated)
Alexei Svitkine (slow)
PTAL! gab+grt: review tommi: OWNERS I've only tried this on the update mention in the ...
6 years, 3 months ago (2014-09-11 21:49:32 UTC) #3
grt (UTC plus 2)
This is awesome. Lgtm.
6 years, 3 months ago (2014-09-11 22:08:03 UTC) #5
gab
Wow, this is amazing! LGTM*1000000.01! I wonder in fact how the STL implements reserve() since ...
6 years, 3 months ago (2014-09-12 03:51:34 UTC) #6
gab
Some thoughts below. https://codereview.chromium.org/565753002/diff/40001/courgette/memory_allocator.h File courgette/memory_allocator.h (right): https://codereview.chromium.org/565753002/diff/40001/courgette/memory_allocator.h#newcode341 courgette/memory_allocator.h:341: size *= 1.01; This will have ...
6 years, 3 months ago (2014-09-12 04:12:19 UTC) #7
gab
https://codereview.chromium.org/565753002/diff/40001/courgette/memory_allocator.h File courgette/memory_allocator.h (right): https://codereview.chromium.org/565753002/diff/40001/courgette/memory_allocator.h#newcode341 courgette/memory_allocator.h:341: size *= 1.01; On 2014/09/12 04:12:19, gab wrote: > ...
6 years, 3 months ago (2014-09-12 04:16:06 UTC) #8
grt (UTC plus 2)
On 2014/09/12 04:12:19, gab wrote: > Some thoughts below. > > https://codereview.chromium.org/565753002/diff/40001/courgette/memory_allocator.h > File courgette/memory_allocator.h ...
6 years, 3 months ago (2014-09-12 04:27:06 UTC) #9
gab
On 2014/09/12 04:27:06, grt wrote: > On 2014/09/12 04:12:19, gab wrote: > > Some thoughts ...
6 years, 3 months ago (2014-09-12 11:39:10 UTC) #10
tommi (sloooow) - chröme
lgtm
6 years, 3 months ago (2014-09-12 14:28:57 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/565753002/40001
6 years, 3 months ago (2014-09-12 14:29:39 UTC) #13
Alexei Svitkine (slow)
I double checked with a few other update combinations and the improvements seem to be ...
6 years, 3 months ago (2014-09-12 14:42:00 UTC) #14
gab
On 2014/09/12 14:42:00, Alexei Svitkine wrote: > I double checked with a few other update ...
6 years, 3 months ago (2014-09-12 15:04:21 UTC) #15
grt (UTC plus 2)
On 2014/09/12 15:04:21, gab wrote: > On 2014/09/12 14:42:00, Alexei Svitkine wrote: > > I ...
6 years, 3 months ago (2014-09-12 15:10:46 UTC) #16
Alexei Svitkine (slow)
Added, I agree it's useful to have for future reference. (Whether TEST= section is the ...
6 years, 3 months ago (2014-09-12 15:13:06 UTC) #17
gab
On 2014/09/12 15:10:46, grt wrote: > On 2014/09/12 15:04:21, gab wrote: > > On 2014/09/12 ...
6 years, 3 months ago (2014-09-12 15:24:45 UTC) #18
commit-bot: I haz the power
Committed patchset #1 (id:40001) as 7ccc48338a2eed3c830ae2253fe73414b30bc9a5
6 years, 3 months ago (2014-09-12 15:28:44 UTC) #19
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/53523269bac5a15fb94da76a879ca3445f096a42 Cr-Commit-Position: refs/heads/master@{#294592}
6 years, 3 months ago (2014-09-12 15:32:24 UTC) #20
tommi (sloooow) - chröme
On 2014/09/12 15:32:24, I haz the power (commit-bot) wrote: > Patchset 1 (id:??) landed as ...
6 years, 3 months ago (2014-09-12 17:46:16 UTC) #21
grt (UTC plus 2)
On 2014/09/12 17:46:16, tommi wrote: > On 2014/09/12 15:32:24, I haz the power (commit-bot) wrote: ...
6 years, 3 months ago (2014-09-12 17:55:40 UTC) #22
Alexei Svitkine (slow)
As a follow-up experiment, I decided to measure how much overhead is still left as ...
6 years, 3 months ago (2014-09-15 16:40:10 UTC) #23
gab
Very nice analysis, your assessment SGTM, thanks Alexei! Can't wait to see field results from ...
6 years, 3 months ago (2014-09-16 03:45:30 UTC) #24
grt (UTC plus 2)
On Mon, Sep 15, 2014 at 12:39 PM, Alexei Svitkine <asvitkine@chromium.org> wrote: > As a ...
6 years, 3 months ago (2014-09-16 13:41:45 UTC) #25
Alexei Svitkine (slow)
6 years, 3 months ago (2014-09-16 14:44:14 UTC) #26
Message was sent while issue was closed.
On 2014/09/16 13:41:45, grt wrote:
> On Mon, Sep 15, 2014 at 12:39 PM, Alexei Svitkine
<mailto:asvitkine@chromium.org>
> wrote:
> 
> > As a follow-up experiment, I decided to measure how much overhead is still
> > left as a result of re-sizing these vectors.
> >
> > The operation of courgette is deterministic. So I added some
> > instrumentation to record all the final vector alloc_size's for each vector
> > ordered by when that vector's constructed and then in a subsequent run to
> > have each vector reserve() to its previous size (and verified that with
> > this, the vectors are never grown).
> >
> > This yielded an additional ~3% improvement. (e.g. running time went from
> > 19s to 18.5s)
> >
> 
> I imagine that the improvement could be more dramatic on a low-ram machine
> that would end up thrashing due to the resizes. Could the patch generation
> process be modified so that it somehow contains the required space needed
> for each of these vectors such that the patch application phase could
> always get exactly the right amount of memory on the first try?

True, I guess it depends on the memory speed on the machine. Do we have any
stats yet from the field on the improvements from the last change? Maybe we can
use those metrics to estimate how much this further optimization will help in
the field.

It's certainly possible (and I was thinking of this) of expanding the patch
format to store this extra info, though the implementation might be a bit ugly
(e.g. either we specialize the vector class in Courgette more and add a global
hook that will be called on construction/destruction - or we have to change all
the places where these vectors are created and destroyed - neither is
particularly elegant, but if the wins are big enough then maybe still worth
doing.)


> 
> 
> >
> > Given that the additional improvement is so minuscule, I don't think it's
> > worth investing any more effort into optimizing this part of courgette (the
> > buffer resizing) beyond this change, that already gives very close to
> > optimal performance here.
> >
> > On Fri, Sep 12, 2014 at 1:55 PM, <mailto:grt@chromium.org> wrote:
> >
> >> On 2014/09/12 17:46:16, tommi wrote:
> >>
> >>> On 2014/09/12 15:32:24, I haz the power (commit-bot) wrote:
> >>> > Patchset 1 (id:??) landed as
> >>> > https://crrev.com/53523269bac5a15fb94da76a879ca3445f096a42
> >>> > Cr-Commit-Position: refs/heads/master@{#294592}
> >>>
> >>
> >>  What a great CL! :) There should be a LOC/Impact ratio on CLs.  This one
> >>> would
> >>> go through the roof!
> >>>
> >>
> >> Indeed! I can't wait to crunch some numbers after this has shipped for a
> >> few
> >> days. I think it's going to be major goodness.
> >>
> >> https://codereview.chromium.org/565753002/
> >>
> >
> >
> 
> To unsubscribe from this group and stop receiving emails from it, send an
email
> to mailto:chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698