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

Issue 2950993002: Make some functions that are hit during renderer startup available for inlining (Closed)

Created:
3 years, 6 months ago by hans
Modified:
3 years, 5 months ago
CC:
Hannes Payer (out of office), marja+watch_chromium.org, v8-reviews_googlegroups.com, Yang
Target Ref:
refs/heads/master
Project:
v8
Visibility:
Public.

Description

Make some functions that are hit during renderer startup available for inlining This is towards closing the perf gap between the MSVC build (which uses link- time optimization) and Clang (where LTO isn't ready on Windows yet). We did a study (see bug) to see which non-inlined functions are hit a lot during render start-up, and which would be inlined during LTO. This should benefit performance in all builds which currently don't use LTO (Android, Linux, Mac) as well as the Win/Clang build. The binary size of chrome_child.dll increases by 2KB with this. BUG=chromium:728324 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_compile_dbg_ng;master.tryserver.chromium.mac:mac_chromium_compile_dbg_ng Review-Url: https://codereview.chromium.org/2950993002 Cr-Commit-Position: refs/heads/master@{#46229} Committed: https://chromium.googlesource.com/v8/v8/+/777da354d20286d39048f1421d89fa109e38b9e1

Patch Set 1 #

Total comments: 2

Patch Set 2 : don't expose bytecode-traits.h in bytecodes.h #

Total comments: 3

Patch Set 3 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+291 lines, -312 lines) Patch
M src/ast/ast.h View 1 2 1 chunk +11 lines, -1 line 0 comments Download
M src/ast/ast.cc View 1 chunk +0 lines, -11 lines 0 comments Download
M src/ast/scopes.h View 2 chunks +13 lines, -2 lines 0 comments Download
M src/ast/scopes.cc View 1 2 1 chunk +0 lines, -14 lines 0 comments Download
M src/ast/variables.h View 1 2 1 chunk +18 lines, -1 line 0 comments Download
M src/ast/variables.cc View 1 2 1 chunk +0 lines, -20 lines 0 comments Download
M src/heap/heap.h View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M src/heap/heap.cc View 1 2 1 chunk +0 lines, -5 lines 0 comments Download
M src/heap/heap-inl.h View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M src/heap/objects-visiting.h View 1 2 1 chunk +3 lines, -3 lines 0 comments Download
M src/heap/objects-visiting.cc View 1 chunk +0 lines, -199 lines 0 comments Download
M src/heap/objects-visiting-inl.h View 1 2 1 chunk +198 lines, -0 lines 0 comments Download
M src/heap/scavenger.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/heap/scavenger.cc View 1 2 1 chunk +0 lines, -11 lines 0 comments Download
M src/heap/scavenger-inl.h View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
M src/interpreter/bytecodes.h View 1 2 2 chunks +12 lines, -2 lines 0 comments Download
M src/interpreter/bytecodes.cc View 1 2 chunks +12 lines, -25 lines 0 comments Download
M src/parsing/scanner.h View 1 chunk +5 lines, -1 line 0 comments Download
M src/parsing/scanner.cc View 1 2 1 chunk +0 lines, -7 lines 0 comments Download
M src/snapshot/snapshot-source-sink.h View 1 chunk +4 lines, -1 line 0 comments Download
M src/snapshot/snapshot-source-sink.cc View 1 chunk +0 lines, -6 lines 0 comments Download

Messages

Total messages: 66 (22 generated)
hans
Please take a look.
3 years, 6 months ago (2017-06-20 21:51:38 UTC) #2
rmcilroy
https://codereview.chromium.org/2950993002/diff/1/src/interpreter/bytecodes.h File src/interpreter/bytecodes.h (right): https://codereview.chromium.org/2950993002/diff/1/src/interpreter/bytecodes.h#newcode14 src/interpreter/bytecodes.h:14: #include "src/interpreter/bytecode-traits.h" I'd prefer not to expose bytecode-traits in ...
3 years, 6 months ago (2017-06-20 23:20:33 UTC) #8
hans
https://codereview.chromium.org/2950993002/diff/1/src/interpreter/bytecodes.h File src/interpreter/bytecodes.h (right): https://codereview.chromium.org/2950993002/diff/1/src/interpreter/bytecodes.h#newcode14 src/interpreter/bytecodes.h:14: #include "src/interpreter/bytecode-traits.h" On 2017/06/20 23:20:32, rmcilroy wrote: > I'd ...
3 years, 6 months ago (2017-06-20 23:49:08 UTC) #9
vogelheim
Generally, this looks good, and 2kB code size certainly looks like an acceptable trade-off. The ...
3 years, 6 months ago (2017-06-21 10:18:02 UTC) #11
jochen (gone - plz use gerrit)
what's the expected difference in startup from this change? https://codereview.chromium.org/2950993002/diff/20001/src/heap/objects-visiting.h File src/heap/objects-visiting.h (right): https://codereview.chromium.org/2950993002/diff/20001/src/heap/objects-visiting.h#newcode89 src/heap/objects-visiting.h:89: ...
3 years, 6 months ago (2017-06-21 10:24:21 UTC) #12
Nico
Re code health: I looked at v8's slow build time,l a while ago, and back ...
3 years, 6 months ago (2017-06-21 10:32:37 UTC) #13
Michael Lippautz
Can you quantify the impact of inlining the Scavenger slow path? ScavengeObjectSlow should result in ...
3 years, 6 months ago (2017-06-21 10:46:14 UTC) #14
rmcilroy
On 2017/06/20 23:49:08, hans wrote: > https://codereview.chromium.org/2950993002/diff/1/src/interpreter/bytecodes.h > File src/interpreter/bytecodes.h (right): > > https://codereview.chromium.org/2950993002/diff/1/src/interpreter/bytecodes.h#newcode14 > ...
3 years, 6 months ago (2017-06-21 12:45:38 UTC) #15
marja
Q1: How much impact does this CL have? Q2 (more meta): If de-inlining the ast ...
3 years, 6 months ago (2017-06-21 14:21:10 UTC) #17
marja
Ah, noticed thakis's answer. The current problem with build times we're trying to address is ...
3 years, 6 months ago (2017-06-21 14:25:05 UTC) #18
marja
parsing/ lgtm too
3 years, 6 months ago (2017-06-21 14:25:32 UTC) #19
hans
I realize this is trading a bit of build time and header complexity against performance. ...
3 years, 6 months ago (2017-06-21 15:25:14 UTC) #20
hans
vogelheim: owner ping for snapshot/ mstarzinger: owner ping for heap/ and interpreter/ As I mentioned ...
3 years, 6 months ago (2017-06-22 13:57:21 UTC) #21
Michael Starzinger
Sorry for delay, wasn't aware I was a required reviewer on this. LGTM on "interpreter", ...
3 years, 6 months ago (2017-06-22 14:35:36 UTC) #23
Michael Lippautz
Are you solely evaluating based on UMA call counts here? Call counts do not necessarily ...
3 years, 6 months ago (2017-06-22 15:55:48 UTC) #24
hans
On 2017/06/22 15:55:48, Michael Lippautz wrote: > Are you solely evaluating based on UMA call ...
3 years, 6 months ago (2017-06-23 03:23:07 UTC) #25
Michael Lippautz
I am fine with inlining in the Scavenger in this CL. The approach in general ...
3 years, 6 months ago (2017-06-23 09:15:01 UTC) #26
marja
On 2017/06/23 09:15:01, Michael Lippautz wrote: > I am fine with inlining in the Scavenger ...
3 years, 6 months ago (2017-06-23 11:04:22 UTC) #27
hans
On 2017/06/23 09:15:01, Michael Lippautz wrote: > I am fine with inlining in the Scavenger ...
3 years, 6 months ago (2017-06-23 14:05:48 UTC) #28
hans
On 2017/06/23 11:04:22, marja wrote: > > > That it shrinks the difference between MSVC ...
3 years, 6 months ago (2017-06-23 14:11:08 UTC) #29
hans
mlippautz, vogelheim: I believe I have approval from the others. If there is more I ...
3 years, 6 months ago (2017-06-23 14:12:54 UTC) #30
Nico
v8 folks: As said above, if this doesn't help, we'll gladly revert this. If it ...
3 years, 6 months ago (2017-06-23 15:49:22 UTC) #32
Michael Lippautz
lgtm for what it's worth The approach itself does not look good to me and ...
3 years, 6 months ago (2017-06-23 16:05:31 UTC) #33
Nico
On 2017/06/23 16:05:31, Michael Lippautz wrote: > lgtm for what it's worth Thanks for the ...
3 years, 6 months ago (2017-06-23 16:09:57 UTC) #34
Michael Lippautz
On 2017/06/23 16:09:57, Nico wrote: > On 2017/06/23 16:05:31, Michael Lippautz wrote: > > lgtm ...
3 years, 6 months ago (2017-06-23 16:38:57 UTC) #35
Michael Lippautz
One more thing: I just saw that we ship the clang build and there should ...
3 years, 6 months ago (2017-06-23 16:45:48 UTC) #36
Nico
vogelheim, I think we need your approval too. On 2017/06/23 16:38:57, Michael Lippautz wrote: > ...
3 years, 6 months ago (2017-06-23 16:54:34 UTC) #37
Nico
vogelheim, I think we need your approval too. On 2017/06/23 16:38:57, Michael Lippautz wrote: > ...
3 years, 6 months ago (2017-06-23 16:54:35 UTC) #38
hans
With mlippautz's help, I ran Typescript-octane2.1 locally; two runs (each took about 5 minutes) with ...
3 years, 6 months ago (2017-06-23 18:06:37 UTC) #39
vogelheim
On 2017/06/23 18:06:37, hans wrote: > With mlippautz's help, I ran Typescript-octane2.1 locally; two runs ...
3 years, 6 months ago (2017-06-23 20:00:11 UTC) #40
vogelheim
lgtm The "lgtm" is more due to attrition - I got pinged to "stamp the ...
3 years, 6 months ago (2017-06-23 20:09:48 UTC) #41
Nico
On 2017/06/23 20:09:48, vogelheim wrote: > lgtm Thanks! > The "lgtm" is more due to ...
3 years, 6 months ago (2017-06-23 20:19:40 UTC) #42
hans
On 2017/06/23 20:00:11, vogelheim wrote: > If I read the numbers on the perfbot correctly ...
3 years, 6 months ago (2017-06-23 20:42:39 UTC) #43
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/2950993002/40001
3 years, 6 months ago (2017-06-23 20:42:57 UTC) #46
commit-bot: I haz the power
Committed patchset #3 (id:40001) as https://chromium.googlesource.com/v8/v8/+/d00d52be1fce9c1bf5558c8b26bf984efd09e65b
3 years, 6 months ago (2017-06-23 21:12:28 UTC) #49
Michael Achenbach
A revert of this CL (patchset #3 id:40001) has been created in https://codereview.chromium.org/2955793002/ by machenbach@chromium.org. ...
3 years, 6 months ago (2017-06-25 20:29:39 UTC) #50
hans
On 2017/06/25 20:29:39, Michael Achenbach wrote: > A revert of this CL (patchset #3 id:40001) ...
3 years, 5 months ago (2017-06-26 17:40:12 UTC) #53
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/2950993002/40001
3 years, 5 months ago (2017-06-26 17:40:40 UTC) #55
commit-bot: I haz the power
Your CL can not be processed by CQ because of: * Failed to parse additional ...
3 years, 5 months ago (2017-06-26 17:40:43 UTC) #57
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/2950993002/40001
3 years, 5 months ago (2017-06-26 17:41:50 UTC) #60
commit-bot: I haz the power
Committed patchset #3 (id:40001) as https://chromium.googlesource.com/v8/v8/+/777da354d20286d39048f1421d89fa109e38b9e1
3 years, 5 months ago (2017-06-26 18:17:17 UTC) #63
hans
To follow up: since this got reverted initially (sorry, I should have watched the roller), ...
3 years, 5 months ago (2017-06-28 21:35:27 UTC) #64
Michael Lippautz
On 2017/06/28 21:35:27, hans wrote: > To follow up: since this got reverted initially (sorry, ...
3 years, 5 months ago (2017-06-29 10:20:30 UTC) #65
hans
3 years, 5 months ago (2017-07-18 08:15:55 UTC) #66
Message was sent while issue was closed.
It took a week longer than expected because there was no Dev channel release on
the week of 3 July.

(If you're at Google, the numbers are at go/61.0.3153.2-uma)

Since most of us were on vacation, this V8 change is the only CL targeting the
MSVC/Clang gap in that release.

What we saw is that on SessionRestore.ForegroundTabFirstLoaded and
Scheduling.Renderer.DrawDuration2, Clang-built Chrome is now faster than
MSVC-built Chrome on the median.

We can't tell with certainty that this is because of the V8 patch, but since we
didn't do any other patches in this release, and since Clang-built Chrome was
previously slower on those metrics, we'd like to keep this if possible.

Having said that, I promised to reconsider these inlinings when we had metrics.

To re-cap, these are the functions that were inlined, along with the number of
times they were called before inlining during NTP load:

205153 Scanner::ScanTemplateContinuation
151841 VariableProxy::VariableProxy(AsRawString, ...)
140454 Scope::NewUnresolved
80931 Scavenger::ScavengeObjectsSlow
57994 Variable::Variable(Scope, AstRawString, ...)
45411 SnapshotByteSource::CopyRaw
37636 Heap::AllocateFixedArray
32558 StaticVisitorBase::GetVisitorId
30137 ByteCodes::SizeOfOperand

I think some of these make a lot of sense on their own, but if you think some of
them need to reverted, I'll do so.

Scope::NewUnresolved was the only one that required including another header
(ast.h in scopes.h). StaticVisitorBase::GetVisitorId is a rather ugly switch
statement, and Scavenger::ScavengeObjectsSlow looks designed to be out-of-line.

I'm also in Munich this week so I can discuss this in person if you'd like.

Powered by Google App Engine
This is Rietveld 408576698