New issue
Advanced search Search tips

Issue 799563 link

Starred by 3 users

Issue metadata

Status: Verified
Owner:
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: 2018-01-09
OS: Linux
Pri: 2
Type: Bug-Regression



Sign in to add a comment

36.9kB regression in resource_sizes (MonochromePublic.apk) at 527277:527277

Project Member Reported by huangs@google.com, Jan 5 2018

Issue description

Caused by “[builtins] Port EnqueueMicrotask to CSA.” (v8)
https://chromium-review.googlesource.com/c/v8/v8/+/851972

Commit: 2b4cc835f14cfd1d195f4f8729140a01b5e22f8d

Link to size graph: https://chromeperf.appspot.com/group_report?keys=agxzfmNocm9tZXBlcmZyFAsSB0Fub21hbHkYgICQmN3gsAoM

Debugging size regressions is documented at: https://chromium.googlesource.com/chromium/src/+/master/docs/speed/apk_size_regressions.md#Debugging-Apk-Size-Increase

Based on the graph: 36.9kB of native code.

It looks like this increase was probably unexpected or might be avoidable.
Please have a look and either:

1. Close as “Won't Fix” with a short justification, or
2. Land a revert / fix-up.

 
All graphs for this bug:
  https://chromeperf.appspot.com/group_report?bug_id=799563

(For debugging:) Original alerts at time of bug-filing:
  https://chromeperf.appspot.com/group_report?sid=6ca337f473a08875818d1728f3a1e0bd00285714f27e2e507f387730cb29c3db


Bot(s) for this bug's original alert(s):

Android Builder

Comment 2 by huangs@google.com, Jan 5 2018

Looks like this mostly comes from assets/snapshot_blob_32.bin ?

Command to run:
tools/binary_size/diagnose_bloat.py 2b4cc835f14cfd1d195f4f8729140a01b5e22f8d --reference-rev 2b4cc835f14cfd1d195f4f8729140a01b5e22f8d^ --subrepo v8 --all -v

Truncated output:

******************************Native Diff******************************
Common Metadata:
    apk_file_name=apks/MonochromePublic.apk
    elf_arch=arm
    elf_file_name=lib.unstripped/libmonochrome.so
    git_revision=f994166392e7fd2f53b2cdf541a2357d7ced3ca9
    gn_args=enable_chrome_android_internal=false is_chrome_branded=true is_official_build=true symbol_level=1 target_os="android" treat_warnings_as_errors=false use_goma=true
    map_file_name=lib.unstripped/libmonochrome.so.map.gz
    tool_prefix=third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
Old Metadata:
    apk_size=65332127
    elf_build_id=41ed88eb36ba6a00c36e3c8a4bfe363263d13b2d
    elf_mtime=2018-01-05 14:42:19
New Metadata:
    apk_size=65368991
    elf_build_id=c9138fcd1834695ffb9a03ce2e14f0ce81757bc2
    elf_mtime=2018-01-05 14:45:26

Section Sizes (Total=36.0kb (36864 bytes)):
    .bss: -32 bytes (-32 bytes) (not included in totals)
    .data: 0 bytes (0 bytes) (0.0%)
    .data.rel.ro: -112 bytes (-112 bytes) (-0.3%)
    .other: 37.5kb (38389 bytes) (104.1%)
    .pak.nontranslated: 0 bytes (0 bytes) (0.0%)
    .pak.translations: 0 bytes (0 bytes) (0.0%)
    .rel.dyn: -128 bytes (-128 bytes) (-0.3%)
    .rodata: -256 bytes (-256 bytes) (-0.7%)
    .text: -1029 bytes (-1029 bytes) (-2.8%)

4 symbols added (+), 17 changed (~), 22 removed (-), 712536 unchanged (not shown)
Of changed symbols, 7 grew, 36 shrank
Number of unique symbols 537879 -> 537867 (-12)
0 paths added, 0 removed, 10 changed

Showing 43 symbols (aliases not grouped for diffs) with total pss: 36992 bytes
Histogram of symbols based on PSS:
    (-512,-256]: 2   (-64,-32]: 8   (-16,-8]: 7   (-4,-2]: 3     [8,16): 1     [1024,2048): 2
     (-128,-64]: 3   (-32,-16]: 8    (-8,-4]: 5     [2,4): 2   [64,128): 1   [32768,65536): 1
.text=-1029 bytes .rodata=-255 bytes .data.rel.ro=-112 bytes .data=0 bytes    .bss=-32 bytes  .pak.translations=0 bytes    .pak.nontranslated=0 bytes    .other=37.5kb     total=36.1kb
Number of unique paths: 11

Section Legend: t=.text, r=.rodata, R=.data.rel.ro, d=.data, b=.bss, p=.pak.translations, P=.pak.nontranslated, o=.other
Index | Running Total | Section@Address | Δ PSS (Δ size_without_padding) | Path
------------------------------------------------------------
~ 0)      35792 (96.9%) o@0x0        35792 (1338024->1373816) {{no path}}
               assets/snapshot_blob_32.bin
~ 1)      37317 (101.0%) o@0x0        1525 (2343->3868)  {{no path}}
               ELF file overhead
~ 2)      38387 (103.9%) o@0x0        1070 (418704->419774) {{no path}}

...

- 42)     36933 (100.0%) b@0x0        -4 (4->0)          v8/src/runtime/runtime-promise.cc
               v8::internal::Stats_Runtime_EnqueuePromiseResolveThenableJob::trace_event_unique_atomic81

******************************Resource Sizes Diff******************************
MonochromePublic.apk_Uncompressed (+0 bytes)
        +0 bytes Non-compiled Android resources size
        +0 bytes Java code size
        +0 bytes Native resources (l10n) size
        +0 bytes Package metadata size
MonochromePublic.apk_TransferSize
   +10,958 bytes Transfer size (deflate)
StaticInitializersCount
        +0 count count
MonochromePublic.apk_MainLibInfo (-1,557 bytes)
        +0 bytes unwind
    -1,029 bytes text
      -128 bytes relocations
       -32 bytes bss
        +0 bytes symbols
        +0 bytes other
      -368 bytes data
MonochromePublic.apk_Breakdown (+36,864 bytes)
        +0 bytes Native resources (no l10n) size
        +0 bytes ICU (i18n library) data size
    +1,070 bytes Zip Overhead
        +0 bytes Unknown files size
        +0 bytes Non-compiled Android resources size
   +35,792 bytes V8 Snapshots size
        +0 bytes Native resources (l10n) size
        +0 bytes Native code size
        +0 bytes PNG drawables size
        +2 bytes Package metadata size
        +0 bytes licenses.notice file size
        +0 bytes Native resources stored (l10n) size
        +0 bytes Java code size
        +0 bytes Compiled Android resources size
MonochromePublic.apk_InstallSize
   +36,864 bytes APK size
 +36,864.0 bytes Estimated installed size
MonochromePublic.apk_InstallBreakdown (+35,794.0 bytes)
        +0 bytes Native resources (no l10n) size
        +0 bytes ICU (i18n library) data size
        +0 bytes Unknown files size
        +0 bytes Non-compiled Android resources size
   +35,792 bytes V8 Snapshots size
        +0 bytes Native resources (l10n) size
        +0 bytes Native code size
        +0 bytes PNG drawables size
        +2 bytes Package metadata size
        +0 bytes licenses.notice file size
        +0 bytes Native resources stored (l10n) size
      +0.0 bytes Java code size
        +0 bytes Compiled Android resources size
MonochromePublic.apk_Specifics
   +36,864 bytes normalized apk size
        +0 zip entries file count
        +0 bytes secondary dex size
        +0 bytes main lib size
        +0 bytes main dex size
        +0 bytes other lib size
MonochromePublic.apk_DexCache
        +0 bytes DexCache
MonochromePublic.apk_Dex
        +0 entries fields
        +0 entries methods
        +0 entries types
        +0 entries strings

Comment 3 by huangs@google.com, Jan 5 2018

Meanwhile, I think the bug is unexpected because the CL does not change that many lines of code.
Cc: caitp@chromium.org jgruber@chromium.org gsat...@chromium.org
Components: Blink>JavaScript>Runtime
Labels: OS-Linux
NextAction: 2018-01-09
This looks quite possible, since the CL replaces a runtime call with the inlined version of the code, which has a couple of allocations inside and the copying of the microtask queue. 36kB still sounds like a lot, but we had seen this with the Promise builtins before already.

Sathya, Caitlin, Jakob: What do you think about EnqueueMicrotask as a single builtin that we call from all these places? That should mitigate the regression significantly?

Comment 5 by caitp@chromium.org, Jan 7 2018

I'm fine with it being primarily invoked as a codestub. Maybe there are a few cases wjere its worth inlining, though (like when creating a Promise ResolveThenableJob seems fairly common)
Calling PromiseBuiltinsAssembler::EnqueueMicrotask as a builtin sgtm. 

Also I wonder whether it's really beneficial to have two separate paths for large-object- / new-space that only differ in write barriers - is the performance impact visible? Just a thought, but this would cut down on code size and readability.
Making EnqueueMicrotask a single builtin SGTM.
The NextAction date has arrived: 2018-01-09
Project Member

Comment 9 by bugdroid1@chromium.org, Jan 9 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/6ef05c78503c5d6580d07a29c2a200f6c7a89979

commit 6ef05c78503c5d6580d07a29c2a200f6c7a89979
Author: Benedikt Meurer <bmeurer@chromium.org>
Date: Tue Jan 09 18:16:09 2018

[builtins] Turn EnqueueMicrotask into a dedicated builtin.

Inlining the EnqueueMicrotask logic into the various uses blows up the
snapshot size significantly. So instead of doing that we just turn the
operation into a dedicated builtin that we call from the various uses.
This still avoids the runtime function call overhead and maintains the
fast path without write barriers for the common case of the microtask
queue fitting into new space.

This also moves back the microtask helper CSA functions to the
specialized assembler.

Bug: v8:7253,  chromium:799563 
Change-Id: I2d24d0e5c01e442c5ad7f5d4373fbc6e94351ac5
Reviewed-on: https://chromium-review.googlesource.com/856618
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50461}
[modify] https://crrev.com/6ef05c78503c5d6580d07a29c2a200f6c7a89979/src/builtins/builtins-definitions.h
[modify] https://crrev.com/6ef05c78503c5d6580d07a29c2a200f6c7a89979/src/builtins/builtins-internal-gen.cc
[modify] https://crrev.com/6ef05c78503c5d6580d07a29c2a200f6c7a89979/src/builtins/builtins-promise-gen.cc
[modify] https://crrev.com/6ef05c78503c5d6580d07a29c2a200f6c7a89979/src/builtins/builtins-promise-gen.h
[modify] https://crrev.com/6ef05c78503c5d6580d07a29c2a200f6c7a89979/src/code-stub-assembler.cc
[modify] https://crrev.com/6ef05c78503c5d6580d07a29c2a200f6c7a89979/src/code-stub-assembler.h

Status: Fixed (was: Assigned)
Issue 799938 has been merged into this issue.
Cc: bmeu...@chromium.org
 Issue 800300  has been merged into this issue.
Issue 800290 has been merged into this issue.
Status: Verified (was: Fixed)
v8 roll shows a 36kb savings from this. Woot!

https://chromeperf.appspot.com/report?sid=d4ad0c0ca13532bc603ccb2fbf832ac334993838534598c9087515088ede48e2&rev=528255
 Issue 800293  has been merged into this issue.
 Issue 800292  has been merged into this issue.

Sign in to add a comment