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

Issue 2149483002: Reduce chrome.exe .text size by 50 KB with static_library (Closed)

Created:
4 years, 5 months ago by brucedawson
Modified:
4 years, 5 months ago
Reviewers:
brettw, Nico
CC:
chromium-reviews, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, asvitkine+watch_chromium.org, darin (slow to review), ben+mojo_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Reduce chrome.exe .text size by 50 KB with static_library Also improves build times. chrome.exe's .text (code) section in gn builds is about 55 KB larger than in gyp builds (32-bit official). This is largely or completely because of the use of source sets. The gn build links with about 320 .obj files whereas the gyp build links with ten. The linker pulls in all of those .obj files and then fails to do a perfect job of discarding the unused code and data. This change gets rid of ~50 KB of this discrepancy by changing several build targets from source_set to static_library and reducing the number of .obj files to be linked to 72. The size gain came from the change to components/variations, but the other changes help to ensure that the size gain sticks, and help with build speeds. This change reduces the build times for relinking the affected binaries (mostly chrome.dll and chrome_child.dll) in an official build about 4-7%. Some source_set targets could not be changed. These were annotated as such to avoid wasting time on them in the future. BUG=624274 Committed: https://crrev.com/fe9b427bc2c5c840906daef07c6dd6789cfc6447 Cr-Commit-Position: refs/heads/master@{#405671}

Patch Set 1 #

Patch Set 2 : Another five or so changes #

Patch Set 3 : Remove static_library for gfx:selection_bound_sources #

Patch Set 4 : gfx:memory_buffer_sources can't be a source_set due to exports #

Patch Set 5 : Remove static_library from libpng #

Patch Set 6 : Tweaking comments #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+20 lines, -17 lines) Patch
M breakpad/BUILD.gn View 1 chunk +1 line, -1 line 0 comments Download
M build/secondary/third_party/crashpad/crashpad/client/BUILD.gn View 1 chunk +1 line, -1 line 0 comments Download
M build/secondary/third_party/crashpad/crashpad/compat/BUILD.gn View 1 chunk +1 line, -1 line 0 comments Download
M build/secondary/third_party/crashpad/crashpad/handler/BUILD.gn View 1 chunk +1 line, -1 line 0 comments Download
M build/secondary/third_party/crashpad/crashpad/minidump/BUILD.gn View 1 chunk +1 line, -1 line 0 comments Download
M build/secondary/third_party/crashpad/crashpad/snapshot/BUILD.gn View 1 chunk +1 line, -1 line 0 comments Download
M build/secondary/third_party/crashpad/crashpad/util/BUILD.gn View 1 chunk +1 line, -1 line 0 comments Download
M build/secondary/third_party/libjpeg_turbo/BUILD.gn View 1 2 chunks +2 lines, -2 lines 0 comments Download
M components/bookmarks/common/BUILD.gn View 1 1 chunk +1 line, -1 line 0 comments Download
M components/browser_watcher/BUILD.gn View 1 2 chunks +2 lines, -2 lines 0 comments Download
M components/crash/content/app/BUILD.gn View 1 1 chunk +1 line, -1 line 0 comments Download
M components/metrics/BUILD.gn View 1 chunk +1 line, -1 line 0 comments Download
M components/variations/BUILD.gn View 1 chunk +1 line, -1 line 0 comments Download
M mojo/public/cpp/bindings/BUILD.gn View 1 chunk +1 line, -1 line 0 comments Download
M third_party/brotli/BUILD.gn View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/libpng/BUILD.gn View 1 2 3 4 5 1 chunk +1 line, -0 lines 2 comments Download
M ui/gfx/BUILD.gn View 1 2 3 4 5 2 chunks +2 lines, -0 lines 0 comments Download

Messages

Total messages: 16 (8 generated)
brucedawson
PTAL. This was created by focusing on chrome.exe and it also improves build times overall. ...
4 years, 5 months ago (2016-07-14 20:40:19 UTC) #5
brettw
LGTM. I also converted some other third_party stuff here https://codereview.chromium.org/2152033002 (I removed collisions with your ...
4 years, 5 months ago (2016-07-14 21:38:38 UTC) #6
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/2149483002/100001
4 years, 5 months ago (2016-07-15 00:40:22 UTC) #8
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 5 months ago (2016-07-15 02:03:05 UTC) #10
commit-bot: I haz the power
CQ bit was unchecked.
4 years, 5 months ago (2016-07-15 02:03:07 UTC) #11
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/fe9b427bc2c5c840906daef07c6dd6789cfc6447 Cr-Commit-Position: refs/heads/master@{#405671}
4 years, 5 months ago (2016-07-15 02:04:59 UTC) #13
Nico
https://codereview.chromium.org/2149483002/diff/100001/third_party/libpng/BUILD.gn File third_party/libpng/BUILD.gn (right): https://codereview.chromium.org/2149483002/diff/100001/third_party/libpng/BUILD.gn#newcode36 third_party/libpng/BUILD.gn:36: # Cannot be a static_library in component builds fwiw ...
4 years, 5 months ago (2016-07-15 14:08:07 UTC) #15
brucedawson
4 years, 5 months ago (2016-07-15 18:08:54 UTC) #16
Message was sent while issue was closed.
https://codereview.chromium.org/2149483002/diff/100001/third_party/libpng/BUI...
File third_party/libpng/BUILD.gn (right):

https://codereview.chromium.org/2149483002/diff/100001/third_party/libpng/BUI...
third_party/libpng/BUILD.gn:36: # Cannot be a static_library in component builds
On 2016/07/15 14:08:07, Nico wrote:
> fwiw in gyp it's a component on windows and a static library elsewhere

Yep, and you can't pull a static_library with exports into a DLL so on Windows
we would need to make it a source_set in component builds and a static_library
otherwise. I wasn't sure if it was worth the extra complexity for the 17 .obj
files that this represents.

Powered by Google App Engine
This is Rietveld 408576698