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

Issue 2163823002: Reduce chrome.dll size by careful use of static_library (Closed)

Created:
4 years, 5 months ago by brucedawson
Modified:
4 years, 5 months ago
Reviewers:
brettw, DaleCurtis
CC:
chromium-reviews, darin-cc_chromium.org, feature-media-reviews_chromium.org, jam, mlamouri+watch-content_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.dll size by careful use of static_library Linking with a source_set tells the linker to pull in all of the code and data from the specified object files, and then discard those that can be proved to be unnecessary. This can cause extraneous global variables and code to be retained, which has led to a regression in the size of chrome.dll in gn builds, compared to gyp builds. This change avoids linking in three arrays from ffmpeg. All of these arrays have multiple instances, each half the size of the previous, so the listed sizes below should all be doubled. The necessary changes were tracked down by using dia2dump to find large global variables and then running a python script to find the chain of object files that caused these global to be pulled in. The arrays are: ff_cos_65536_fixed - 64 KB, fixed by a previous ffmpeg change which enables these fixes. ff_sin_65536 - 128 KiB is defined in ffmpeg's rdft.c. Pulled in by: - service_worker_network_provider.obj, through //content/child:child - render_frame_observer.obj, through //content/public/renderer:renderer_sources - render_widget_mus_connection.obj, //content/renderer/mus:mus - resource_converter.obj, through //content/renderer:renderer ff_cos_65536 - 128 KiB is defined in ffmpeg's fft_template.c which is #included by fft_float.c. Pulled in by: - audio_video_metadata_extractor.obj and media_file_checker.obj, through //media/base:base Changing ffmpeg and the five source_set targets to static_library targets (conditionally in some cases) means that these arrays no longer get pulled in. The expected in-memory savings in the .data section are (64+128+128)*2 KiB = 640 KiB. Actual savings were 718 KiB. This does not affect file size. In addition this saved 288 KiB of code in the .text section, and shrunk the read-only data section, for a 301 KiB file-size savings. Before: size of chrome.dll is 38.808576 MB name: mem size , disk size .text: 30.999296 MB .rdata: 6.007834 MB .data: 1.447656 MB, 0.270336 MB After: size of chrome.dll is 38.499840 MB name: mem size , disk size .text: 30.704163 MB .rdata: 6.006906 MB .data: 0.712680 MB, 0.270336 MB Measurements were done on 32-bit official builds from hash b8c16c8de1. Still some more work to be done. BUG=624274 Committed: https://crrev.com/058b59c936aeceebdc94bc3677966e56fd73a7a8 Cr-Commit-Position: refs/heads/master@{#406611}

Patch Set 1 #

Patch Set 2 : One more fix to avoid pulling in rdft.obj #

Patch Set 3 : Make //content/child static_library conditional #

Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -5 lines) Patch
M content/child/BUILD.gn View 1 2 1 chunk +6 lines, -1 line 0 comments Download
M content/public/renderer/BUILD.gn View 1 1 chunk +6 lines, -1 line 0 comments Download
M content/renderer/BUILD.gn View 1 1 chunk +6 lines, -1 line 0 comments Download
M content/renderer/mus/BUILD.gn View 1 chunk +1 line, -1 line 0 comments Download
M media/base/BUILD.gn View 1 chunk +6 lines, -1 line 0 comments Download

Messages

Total messages: 33 (25 generated)
brucedawson
Total in-memory savings of about 1 MiB (a bit fake because most of that memory ...
4 years, 5 months ago (2016-07-20 00:25:08 UTC) #15
DaleCurtis
Did you mean to roll the ffmpeg deps in this?
4 years, 5 months ago (2016-07-20 00:29:28 UTC) #17
brucedawson
Separate CL: https://codereview.chromium.org/2162053003/ I'll make sure it lands first. On Tue, Jul 19, 2016 at ...
4 years, 5 months ago (2016-07-20 00:47:01 UTC) #18
brettw
I think you need to do the same component trick for "child"= for the component ...
4 years, 5 months ago (2016-07-20 05:09:38 UTC) #19
brucedawson
On 2016/07/20 05:09:38, brettw (ping after 24h) wrote: > I think you need to do ...
4 years, 5 months ago (2016-07-20 16:27:04 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/2163823002/40001
4 years, 5 months ago (2016-07-20 17:49:52 UTC) #29
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 5 months ago (2016-07-20 17:54:48 UTC) #31
commit-bot: I haz the power
4 years, 5 months ago (2016-07-20 17:56:19 UTC) #33
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/058b59c936aeceebdc94bc3677966e56fd73a7a8
Cr-Commit-Position: refs/heads/master@{#406611}

Powered by Google App Engine
This is Rietveld 408576698