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

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

Created:
4 years, 4 months ago by sashab
Modified:
4 years, 4 months ago
Reviewers:
rune
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, esprehn
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add a fast-path for independent inherited properties (Note: This patch was reverted in crrev.com/2213223004 because of issues crbug.com/633859 and crbug.com/634254. These issues were caused from setting isInherited to false instead of true for the StyleBuilder generated inherit functions, and a slotting bug from skipping child recalc in HTMLSlotElement and InsertionPoints, which have both now been fixed in this patch & have tests added.) 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/d0c57905368c76aba662dbda3b4e13cb9bd454bf Cr-Commit-Position: refs/heads/master@{#413406}

Patch Set 1 #

Patch Set 2 : Fix for shadow roots #

Total comments: 6

Patch Set 3 : Fixed slotting bug and added test #

Patch Set 4 : Added 2 more tests #

Unified diffs Side-by-side diffs Delta from patch set Stats (+512 lines, -20 lines) Patch
A third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path.html View 1 chunk +72 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path-inherit-keyword.html View 1 2 3 1 chunk +22 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path-initial-keyword.html View 1 2 3 1 chunk +25 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path-multiple-properties.html View 1 chunk +95 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/css/invalidation/independent-inheritance-fast-path-slots.html View 1 2 1 chunk +63 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/css/invalidation/non-independent-inheritance-identical-computed-styles.html View 1 chunk +74 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/build/scripts/css_properties.py View 2 chunks +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/build/scripts/make_style_builder.py View 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl View 1 2 4 chunks +12 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSProperties.in View 1 2 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 1 chunk +6 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Element.cpp View 1 3 chunks +32 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Node.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/HTMLSlotElement.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/style/ComputedStyle.h View 1 2 10 chunks +54 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/style/ComputedStyle.cpp View 1 2 5 chunks +37 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/style/ComputedStyleConstants.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 26 (17 generated)
sashab
Hi Rune - me again :) This patch... This was LGTMd by esprehn@ and landed. ...
4 years, 4 months ago (2016-08-18 04:47:15 UTC) #6
rune
https://codereview.chromium.org/2220873002/diff/20001/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/2220873002/diff/20001/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); Shouldn't this be false? Last time I looked ...
4 years, 4 months ago (2016-08-18 08:06:49 UTC) #7
sashab
Thanks Rune -- both bugs fixed properly & added layout tests for them & an ...
4 years, 4 months ago (2016-08-19 05:35:25 UTC) #14
rune
lgtm
4 years, 4 months ago (2016-08-19 08:30:57 UTC) #17
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/2220873002/60001
4 years, 4 months ago (2016-08-22 00:35:30 UTC) #19
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/126762)
4 years, 4 months ago (2016-08-22 02:03:40 UTC) #21
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/2220873002/60001
4 years, 4 months ago (2016-08-22 03:03:32 UTC) #23
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 4 months ago (2016-08-22 04:52:39 UTC) #24
commit-bot: I haz the power
4 years, 4 months ago (2016-08-22 04:54:41 UTC) #26
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/d0c57905368c76aba662dbda3b4e13cb9bd454bf
Cr-Commit-Position: refs/heads/master@{#413406}

Powered by Google App Engine
This is Rietveld 408576698