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

Issue 2620653004: Optimize GetPathForVectorIcon*, save ~290 KB on disk (Closed)

Created:
3 years, 11 months ago by brucedawson
Modified:
3 years, 9 months ago
CC:
chromium-reviews, kalyank, sadrul
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Optimize GetPathForVectorIcon*, save ~290 KB on disk VC++ was initializing all of the static PathElement arrays in GetPathForVectorIcon and GetPathForVectorIconAt1xScale at runtime, which meant that these were the largest and sixth largest functions in chrome.dll, and similarly in chrome_child.dll. Tagging the arrays and types as constexpr shrinks these functions down to nothing, saves about ~50 KB of per-process private data, and actually helps them compile slightly faster. The approximate section size changes are: .text: -164224 bytes change .rdata: 51984 bytes change .data: -54976 bytes change .reloc: -23204 bytes change These gains apply both to chrome.dll and chrome_child.dll. BUG=679539 Review-Url: https://codereview.chromium.org/2620653004 Cr-Commit-Position: refs/heads/master@{#442751} Committed: https://chromium.googlesource.com/chromium/src/+/2681632086283869668714416090a3739ff0e879

Patch Set 1 #

Total comments: 6

Patch Set 2 : Pull to latest #

Patch Set 3 : Add constexpr to another PathElement array definition #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -14 lines) Patch
M ash/resources/vector_icons/vector_icons.cc.template View 1 chunk +1 line, -1 line 0 comments Download
M chrome/app/vector_icons/vector_icons.cc.template View 1 2 1 chunk +1 line, -1 line 2 comments Download
M ui/gfx/vector_icons/vector_icons.cc.template View 2 chunks +1 line, -12 lines 0 comments Download

Messages

Total messages: 39 (25 generated)
brucedawson
PTAL - simple change for some nice wins.
3 years, 11 months ago (2017-01-10 05:28:42 UTC) #14
Evan Stade
geeze, thanks. https://codereview.chromium.org/2620653004/diff/1/ash/resources/vector_icons/vector_icons.cc.template File ash/resources/vector_icons/vector_icons.cc.template (right): https://codereview.chromium.org/2620653004/diff/1/ash/resources/vector_icons/vector_icons.cc.template#newcode14 ash/resources/vector_icons/vector_icons.cc.template:14: static constexpr gfx::PathElement path_name[] = {__VA_ARGS__}; is ...
3 years, 11 months ago (2017-01-10 17:30:26 UTC) #15
brucedawson
https://codereview.chromium.org/2620653004/diff/1/ash/resources/vector_icons/vector_icons.cc.template File ash/resources/vector_icons/vector_icons.cc.template (right): https://codereview.chromium.org/2620653004/diff/1/ash/resources/vector_icons/vector_icons.cc.template#newcode14 ash/resources/vector_icons/vector_icons.cc.template:14: static constexpr gfx::PathElement path_name[] = {__VA_ARGS__}; On 2017/01/10 17:30:26, ...
3 years, 11 months ago (2017-01-10 18:31:54 UTC) #16
brucedawson
I updated the change to pull to latest and to add constexpr to all three ...
3 years, 11 months ago (2017-01-10 21:26:43 UTC) #22
Evan Stade
lgtm https://codereview.chromium.org/2620653004/diff/1/ash/resources/vector_icons/vector_icons.cc.template File ash/resources/vector_icons/vector_icons.cc.template (right): https://codereview.chromium.org/2620653004/diff/1/ash/resources/vector_icons/vector_icons.cc.template#newcode14 ash/resources/vector_icons/vector_icons.cc.template:14: static constexpr gfx::PathElement path_name[] = {__VA_ARGS__}; On 2017/01/10 ...
3 years, 11 months ago (2017-01-11 00:26:22 UTC) #23
brucedawson
https://codereview.chromium.org/2620653004/diff/1/ash/resources/vector_icons/vector_icons.cc.template File ash/resources/vector_icons/vector_icons.cc.template (right): https://codereview.chromium.org/2620653004/diff/1/ash/resources/vector_icons/vector_icons.cc.template#newcode14 ash/resources/vector_icons/vector_icons.cc.template:14: static constexpr gfx::PathElement path_name[] = {__VA_ARGS__}; Ah. Got it. ...
3 years, 11 months ago (2017-01-11 01:05:55 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2620653004/40001
3 years, 11 months ago (2017-01-11 01:07:29 UTC) #26
commit-bot: I haz the power
Committed patchset #3 (id:40001) as https://chromium.googlesource.com/chromium/src/+/2681632086283869668714416090a3739ff0e879
3 years, 11 months ago (2017-01-11 01:14:00 UTC) #29
Wez
Hallo grt@chromium.org, tdanderson@chromium.org! Due to a depot_tools patch which mistakenly removed the OWNERS check for ...
3 years, 10 months ago (2017-02-07 02:31:18 UTC) #31
Wez
On 2017/02/07 02:31:18, Wez wrote: > Hallo mailto:grt@chromium.org, mailto:tdanderson@chromium.org! > Due to a depot_tools patch ...
3 years, 10 months ago (2017-02-07 02:34:20 UTC) #32
Wez
OK, re-instating grt@ and tdanderson@ as reviewers, for the ash/resources and chrome/app files.
3 years, 10 months ago (2017-02-07 05:54:24 UTC) #36
grt (UTC plus 2)
chrome/app lgtm https://codereview.chromium.org/2620653004/diff/40001/chrome/app/vector_icons/vector_icons.cc.template File chrome/app/vector_icons/vector_icons.cc.template (right): https://codereview.chromium.org/2620653004/diff/40001/chrome/app/vector_icons/vector_icons.cc.template#newcode17 chrome/app/vector_icons/vector_icons.cc.template:17: const gfx::VectorIcon icon_name = { path_name , ...
3 years, 10 months ago (2017-02-07 07:46:15 UTC) #37
brucedawson
https://codereview.chromium.org/2620653004/diff/40001/chrome/app/vector_icons/vector_icons.cc.template File chrome/app/vector_icons/vector_icons.cc.template (right): https://codereview.chromium.org/2620653004/diff/40001/chrome/app/vector_icons/vector_icons.cc.template#newcode17 chrome/app/vector_icons/vector_icons.cc.template:17: const gfx::VectorIcon icon_name = { path_name , path_name_1x }; ...
3 years, 10 months ago (2017-02-21 17:52:12 UTC) #38
tdanderson
3 years, 9 months ago (2017-03-21 17:45:24 UTC) #39
Message was sent while issue was closed.
On 2017/02/21 17:52:12, brucedawson wrote:
>
https://codereview.chromium.org/2620653004/diff/40001/chrome/app/vector_icons...
> File chrome/app/vector_icons/vector_icons.cc.template (right):
> 
>
https://codereview.chromium.org/2620653004/diff/40001/chrome/app/vector_icons...
> chrome/app/vector_icons/vector_icons.cc.template:17: const gfx::VectorIcon
> icon_name = { path_name , path_name_1x };
> On 2017/02/07 07:46:15, grt (UTC plus 1) wrote:
> > why not here as well? it may not have the same wondrous gains as the macro
> > above, but it seems equally valid for this to be static constexpr (unless
i'm
> > missing something).
> 
> The only reason it wasn't added was because it wasn't needed. Agreed that it
> would be valid and appropriate. At some point we should do an aggressive pass
> over Chrome's source code to add constexpr to thousands of places. If VC++
2017
> gets a constexpr feature that I'm hoping for then this process can be pushed
> much further.
> 
> So, we could add constexpr here (the static is actually unneeded as const and
> constexpr both imply static - I should have removed the static from line 14)
but
> I'm inclined to treat doing so so as no higher priority than the other
> ~thousands of const globals.

ash/resources LGTM

Powered by Google App Engine
This is Rietveld 408576698