New issue
Advanced search Search tips

Issue 698733 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug


Show other hotlists

Hotlists containing this issue:
speed-binarysize-backlog


Sign in to add a comment

[meta] Reduce the size of machine code using line number table from debug info (using bloaty)

Project Member Reported by pasko@chromium.org, Mar 6 2017

Issue description

Let's see how much machine code is generated in libchrome.so for each debugger-step-able source line of code.

Proposing to link to this issue all patches/CLs based on insights like this.

To dump per-line size info for the top 1000 lines:
1) Download & build bloaty from https://github.com/google/bloaty
2) Build libchrome.so with is_official_build=true
3) Run: bloaty --debug-file out/Release/lib.unstripped/libchrome.so -n 1000 -s file -w -d inlines out/Release/libchrome.so > inlines.txt


Note: Another new tool popped up that seems similar:
http://lists.llvm.org/pipermail/llvm-dev/2018-September/126501.html
 
Labels: binay-size
Some additional (Googler-only for now) context on what this means: https://goto.google.com/crbug698733

Comment 3 by pasko@chromium.org, Mar 30 2017

Labels: -binay-size Binary-Size
Project Member

Comment 4 by bugdroid1@chromium.org, Mar 31 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7231325cc8642ceebcff903a590d3dccab5d7e65

commit 7231325cc8642ceebcff903a590d3dccab5d7e65
Author: pasko <pasko@chromium.org>
Date: Fri Mar 31 13:49:51 2017

Prerender: Remove PerceivedPLT histograms

Reasons:
* We stopped looking at this class of metrics
* It saves 5320 bytes of the code size on Android (see below)
* Saves multi-GiB of data on UMA servers

Removing PerceivedPLT also made a bit of state unused, hence it was removed:
* PrerenderHistograms objects are now almost stateless
* PrerenderTabHelper now only manages origin_, url_ and swap_ticks_

To confirm the binary size change:
1. build chrome_apk with is_official_build = true
2. shell> find out/ReleaseOfficial/gen -name libchrome.so -exec size {} \;

BUG=698733,698956,603203

Review-Url: https://codereview.chromium.org/2738783002
Cr-Commit-Position: refs/heads/master@{#461105}

[modify] https://crrev.com/7231325cc8642ceebcff903a590d3dccab5d7e65/chrome/browser/prerender/prerender_browsertest.cc
[modify] https://crrev.com/7231325cc8642ceebcff903a590d3dccab5d7e65/chrome/browser/prerender/prerender_histograms.cc
[modify] https://crrev.com/7231325cc8642ceebcff903a590d3dccab5d7e65/chrome/browser/prerender/prerender_histograms.h
[modify] https://crrev.com/7231325cc8642ceebcff903a590d3dccab5d7e65/chrome/browser/prerender/prerender_manager.cc
[modify] https://crrev.com/7231325cc8642ceebcff903a590d3dccab5d7e65/chrome/browser/prerender/prerender_manager.h
[modify] https://crrev.com/7231325cc8642ceebcff903a590d3dccab5d7e65/chrome/browser/prerender/prerender_tab_helper.cc
[modify] https://crrev.com/7231325cc8642ceebcff903a590d3dccab5d7e65/chrome/browser/prerender/prerender_tab_helper.h
[modify] https://crrev.com/7231325cc8642ceebcff903a590d3dccab5d7e65/tools/metrics/histograms/histograms.xml

Labels: -binary-size Performance-Size
Project Member

Comment 6 by bugdroid1@chromium.org, Sep 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b2d8479c6d85a2d836bdaa340ec450f40c8627f4

commit b2d8479c6d85a2d836bdaa340ec450f40c8627f4
Author: Egor Pasko <pasko@chromium.org>
Date: Wed Sep 06 01:43:40 2017

Remove a few prerender histograms

This saves ~6.5 KiB of .text on Android by removing expansions of histogram
maros in prerender_histograms.cc. A few macros were converted to their
counterparts from histogram_functions.h, others were removed as no longer
useful.

Cleanup of impossible paths leading to these calls (such as
ORIGIN_OFFLINE or ORIGIN_INSTANT) is postponed for future changes.

Histograms that could still be recorded with nostate-prefetch:

OmniboxPrerenderCount:
  * Can approximate sufficiently from FinalStatus.
TimeSinceLastRecentVisit:
  * Was not used in any of our recent analysis.
PrerendersPerSessionCount:
  * Recorded on iOS, not used in our recent analysis for
    desktop/Android, can approximate with FinalStatus.
TimeBetweenPrerenderRequests
  * Does not look actionable.

Swap-in cannot be triggered any more except with the AMP/CCT flow, where
it swaps over an empty/fake WebContents, which makes the following
histograms no longer interesting:

PercentLoadDoneAtSwapin, OmniboxNavigationsUsedPrerenderCount,
TimeUntilUsed2, AbandonTimeUntilUsed, NetworkBytesUsed.

Bug: 603203, 698733
Change-Id: I193e8748804f7653c676ad2bedd353af739b3b5e
Reviewed-on: https://chromium-review.googlesource.com/647762
Reviewed-by: Matthew Cary <mattcary@chromium.org>
Reviewed-by: Josh Karlin <jkarlin@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Commit-Queue: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#499840}
[modify] https://crrev.com/b2d8479c6d85a2d836bdaa340ec450f40c8627f4/chrome/browser/prerender/prerender_contents.cc
[modify] https://crrev.com/b2d8479c6d85a2d836bdaa340ec450f40c8627f4/chrome/browser/prerender/prerender_histograms.cc
[modify] https://crrev.com/b2d8479c6d85a2d836bdaa340ec450f40c8627f4/chrome/browser/prerender/prerender_histograms.h
[modify] https://crrev.com/b2d8479c6d85a2d836bdaa340ec450f40c8627f4/chrome/browser/prerender/prerender_manager.cc
[modify] https://crrev.com/b2d8479c6d85a2d836bdaa340ec450f40c8627f4/chrome/browser/prerender/prerender_manager.h
[modify] https://crrev.com/b2d8479c6d85a2d836bdaa340ec450f40c8627f4/tools/metrics/histograms/histograms.xml

Description: Show this description
Summary: [meta] Reduce the size of machine code using line number table from debug info (using bloaty) (was: [meta] Reduce the size of machine code using line number table from debug info)
Update initial comment & title to mention that this can be dumped via bloaty.
Attaching current top 2000.

Example output:
     VM SIZE                                                                                                                                                  FILE SIZE
 --------------                                                                                                                                            --------------
  56.3%  23.9Mi [1710958 Others]                                                                                                                            22.4Mi  54.7%
  20.0%  8.49Mi [Unmapped]                                                                                                                                  8.50Mi  20.7%
   0.6%   241Ki ../../third_party/android_ndk/sources/cxx-stl/llvm-libc++/include/memory:2233                                                                241Ki   0.6%
   0.3%   126Ki ../../third_party/WebKit/Source/platform/wtf/text/WTFString.h:62                                                                             126Ki   0.3%
   0.3%   116Ki ../../third_party/android_ndk/sources/cxx-stl/llvm-libc++/include/utility:437                                                                116Ki   0.3%
   0.3%   115Ki ../../third_party/android_ndk/sources/cxx-stl/llvm-libc++/include/memory:2050                                                                115Ki   0.3%
   0.2%   101Ki ../../third_party/android_ndk/sources/cxx-stl/llvm-libc++/include/vector:635                                                                 101Ki   0.2%
   0.2%  99.6Ki ../../third_party/android_ndk/sources/cxx-stl/llvm-libc++/include/memory:2543                                                               99.6Ki   0.2%
   0.2%  92.6Ki ../../third_party/android_ndk/sources/cxx-stl/llvm-libc++/include/memory:2544                                                               92.6Ki   0.2%
   0.2%  87.3Ki ../../third_party/android_ndk/sources/cxx-stl/llvm-libc++/include/memory:3026                                                               87.3Ki   0.2%
   0.2%  82.3Ki ../../third_party/android_ndk/sources/cxx-stl/llvm-libc++/include/memory:2515                                                               82.3Ki   0.2%
   0.2%  78.2Ki ../../third_party/android_ndk/sources/cxx-stl/llvm-libc++/include/atomic:922                                                                78.2Ki   0.2%
   0.2%  77.1Ki ../../third_party/android_ndk/sources/cxx-stl/llvm-libc++/include/memory:2545                                                               77.1Ki   0.2%
   0.2%  74.3Ki ../../third_party/android_ndk/sources/cxx-stl/llvm-libc++/include/atomic:1017                                                               74.3Ki   0.2%
   0.2%  68.3Ki ../../v8/include/v8.h:9374                                                                                                                  68.3Ki   0.2%
   0.1%  63.6Ki ../../base/bind_internal.h:454                                                                                                              63.6Ki   0.2%
   0.1%  60.0Ki ../../third_party/android_ndk/sources/cxx-stl/llvm-libc++/include/string:1239                                                               60.0Ki   0.1%
   0.1%  57.8Ki ../../third_party/android_ndk/sources/cxx-stl/llvm-libc++/include/type_traits:4458                                                          57.8Ki   0.1%
   0.1%  56.2Ki ../../base/bind_internal.h:211                                                                                                              56.2Ki   0.1%
   0.1%  55.4Ki ../../base/memory/scoped_refptr.h:200                                                                                                       55.4Ki   0.1%
   0.1%  52.7Ki ../../base/memory/scoped_refptr.h:209                                                                                                       52.7Ki   0.1%
   0.1%  51.9Ki ../../base/bind.h:242                                                                                                                       51.9Ki   0.1%
inlines2000.txt
332 KB View Download

Comment 10 by pasko@chromium.org, Jan 16 2018

with lnsdump I could see that after switch to clang a bunch of line numbers were pointing to 0 (clang not very careful in optimized code?), wondering if bloaty would observe the same ..

Comment 11 by agrieve@google.com, Jan 16 2018

Yeah, just click "view" on the attachment and search for :0 and you'll see there are lots of them. There are also many lines that point to "class Foo {", which might mean "generated code for this class", but that's just a guess.
Status: Assigned (was: Available)
Description: Show this description
--debug-file flag seems currently broken (filed https://github.com/google/bloaty/issues/148)

Attaching an updated inlines dump from today via:
bloaty out-gn/Release/lib.unstripped/libmonochrome.so -n 1000 -s file -w -d sections,inlines >inlines-Oct-2018.txt
inlines-Oct-2018.txt
162 KB View Download

Sign in to add a comment