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

Issue 2117143003: Add a fast-path for independent inherited properties (Closed)

Created:
4 years, 5 months ago by sashab
Modified:
4 years, 4 months ago
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-dom_chromium.org, blink-reviews-style_chromium.org, chromium-reviews, dglazkov+blink, eae+blinkwatch, rwlbuis, sof
Base URL:
https://chromium.googlesource.com/chromium/src.git@computedstyle_cleanup_rename_final_member_fields
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add a fast-path for independent inherited properties Add a fast-path for inherited properties which do not depend on and do not affect any other properties on ComputedStyle. When these properties are modified in a parent element, set them directly on ComputedStyle and skip doing a full recalc for elements only affected by this change. Also implemented two of these properties: visibility and pointer-events, storing an extra 2 bits per ComputedStyle. This increases the size of ComputedStyle by 1 byte on Windows and some Android builds (due to aligned fields), which increases the memory usage for a standard page with ~1000 elements by up to 1kb (although potentially up to 4/8kb on 32/64 bit builds due to packing, although this depends on the allocator implementation details) but realistically less since style sharing only creates one ComputedStyle object for each unique style. Benchmarks show a speed increase of up to 2x for setting these properties on the root element of a typical web page (Facebook, Twitter, Pinterest, Amazon, Wikipedia) and letting the change propagate directly onto the child ComputedStyle objects, rather than doing a full style recalc. Initial Benchmarks: https://docs.google.com/spreadsheets/d/1mUuJEs8cPWyNTR7tQw27oxq6fDTvWiAwgatf_g--B4w/edit#gid=1597242813 Follow-up Benchmarks: https://docs.google.com/spreadsheets/d/1mUuJEs8cPWyNTR7tQw27oxq6fDTvWiAwgatf_g--B4w/edit#gid=918856082 BUG=622138 Committed: https://crrev.com/f24dba9f04dd093aac4298378c671ecd44d0fe97 Cr-Commit-Position: refs/heads/master@{#409143}

Patch Set 1 #

Patch Set 2 : Rebase #

Patch Set 3 : Rebase #

Patch Set 4 : Rebase #

Patch Set 5 : Small rename #

Total comments: 11

Patch Set 6 : Review feedback and removed size check to see size of ComputedStyle on windows #

Patch Set 7 : Checked whether the size increased by 1 byte #

Patch Set 8 : Put sizeof check back to normal #

Patch Set 9 : Added useful sizeof check comment #

Total comments: 39

Patch Set 10 : Review feedback #

Patch Set 11 : Review feedback #

Patch Set 12 : Rebase #

Total comments: 6

Patch Set 13 : Review feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+400 lines, -18 lines) Patch
A third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path.html View 3 1 chunk +72 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path-multiple-properties.html View 1 2 3 4 5 1 chunk +95 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/css/invalidation/non-independent-inheritance-identical-computed-styles.html View 3 1 chunk +74 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/build/scripts/css_properties.py View 1 2 3 4 5 6 7 8 9 2 chunks +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/build/scripts/make_style_builder.py View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl View 1 2 3 4 5 6 7 8 9 4 chunks +12 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSProperties.in View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +8 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/css/resolver/StyleResolverStats.h View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/resolver/StyleResolverStats.cpp View 2 chunks +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Element.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +6 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Element.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +32 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Node.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/style/ComputedStyle.h View 1 2 3 4 5 6 7 8 9 10 11 12 10 chunks +54 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/style/ComputedStyle.cpp View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +37 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/style/ComputedStyleConstants.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 58 (39 generated)
sashab
Hey eddy, PTAL :)
4 years, 5 months ago (2016-07-12 23:20:14 UTC) #3
meade_UTC10
I'm not sure I understand exactly what's going on, but the obvious questions for me ...
4 years, 5 months ago (2016-07-13 07:29:13 UTC) #4
sashab
Hi Eddy, Thanks for the great feedback -- I've taken it into account, as well ...
4 years, 5 months ago (2016-07-14 05:08:42 UTC) #17
meade_UTC10
lgtm as far as I can tell. Waiting eagerly hear what people with more experience ...
4 years, 5 months ago (2016-07-14 05:36:58 UTC) #18
sashab
Ty eddy!! :) esprehn ptal :) (I think rune is on vac)
4 years, 5 months ago (2016-07-14 05:52:11 UTC) #20
esprehn
On 2016/07/14 at 05:52:11, sashab wrote: > Ty eddy!! :) > > esprehn ptal :) ...
4 years, 5 months ago (2016-07-14 06:43:05 UTC) #21
sashab
On 2016/07/14 at 06:43:05, esprehn wrote: > On 2016/07/14 at 05:52:11, sashab wrote: > > ...
4 years, 5 months ago (2016-07-18 00:56:10 UTC) #24
Timothy Loh
description "which increases the memory usage for a standard page with ~1000 elements by up ...
4 years, 5 months ago (2016-07-19 01:29:32 UTC) #26
sashab
Done. https://codereview.chromium.org/2117143003/diff/160001/third_party/WebKit/Source/build/scripts/css_properties.py File third_party/WebKit/Source/build/scripts/css_properties.py (right): https://codereview.chromium.org/2117143003/diff/160001/third_party/WebKit/Source/build/scripts/css_properties.py#newcode25 third_party/WebKit/Source/build/scripts/css_properties.py:25: 'isInheritedSetter': None, On 2016/07/19 at 01:29:31, Timothy Loh ...
4 years, 5 months ago (2016-07-19 03:31:35 UTC) #31
esprehn
https://codereview.chromium.org/2117143003/diff/160001/third_party/WebKit/Source/build/scripts/css_properties.py File third_party/WebKit/Source/build/scripts/css_properties.py (right): https://codereview.chromium.org/2117143003/diff/160001/third_party/WebKit/Source/build/scripts/css_properties.py#newcode25 third_party/WebKit/Source/build/scripts/css_properties.py:25: 'isInheritedSetter': None, I think you want is_inherited_setter, but timloh@ ...
4 years, 5 months ago (2016-07-19 03:46:27 UTC) #32
sashab
Thanks guys! Comments inline. https://codereview.chromium.org/2117143003/diff/160001/third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl File third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl (right): https://codereview.chromium.org/2117143003/diff/160001/third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl#newcode65 third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl:65: {{set_is_inherited(property)}}(true); On 2016/07/19 at 03:46:26, ...
4 years, 5 months ago (2016-07-19 06:32:39 UTC) #37
sashab
Ping esprehn :)
4 years, 5 months ago (2016-07-26 00:41:14 UTC) #44
esprehn
Amazing! lgtm w/ nits. https://codereview.chromium.org/2117143003/diff/220001/third_party/WebKit/Source/core/dom/Element.cpp File third_party/WebKit/Source/core/dom/Element.cpp (right): https://codereview.chromium.org/2117143003/diff/220001/third_party/WebKit/Source/core/dom/Element.cpp#newcode1790 third_party/WebKit/Source/core/dom/Element.cpp:1790: RefPtr<ComputedStyle> newStyle; can we do: ...
4 years, 4 months ago (2016-08-02 02:34:59 UTC) #49
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/2117143003/240001
4 years, 4 months ago (2016-08-02 04:30:31 UTC) #52
commit-bot: I haz the power
Committed patchset #13 (id:240001)
4 years, 4 months ago (2016-08-02 05:44:31 UTC) #53
commit-bot: I haz the power
Patchset 13 (id:??) landed as https://crrev.com/f24dba9f04dd093aac4298378c671ecd44d0fe97 Cr-Commit-Position: refs/heads/master@{#409143}
4 years, 4 months ago (2016-08-02 05:45:59 UTC) #55
rune
A revert of this CL (patchset #13 id:240001) has been created in https://codereview.chromium.org/2213223004/ by rune@opera.com. ...
4 years, 4 months ago (2016-08-05 10:05:02 UTC) #56
sashab
WIP in crrev.com/2220873002. Still struggling to fix crbug.com/633859, but I think it has something to ...
4 years, 4 months ago (2016-08-15 07:19:04 UTC) #57
sashab
4 years, 4 months ago (2016-08-15 07:19:06 UTC) #58
Message was sent while issue was closed.
WIP in crrev.com/2220873002.

Still struggling to fix crbug.com/633859, but I think it has something to do
with not propagating through shadow roots.

A bugfix week followed by sheriffing has been pretty bad timing but looking
forward to getting back to this soon :)

Powered by Google App Engine
This is Rietveld 408576698