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

Issue 1655993005: Only cache nth-indices when child count > 32. (Closed)

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

Description

Only cache nth-indices when child count > 32. When matching :nth-* selectors, we sparsely cache the child index count into a hashmap for the parent element. Doing this regardlessly gave us a performance penalty for small number of children as where noticed in a performance degradation for [1]. The new approach is to not cache any indices until we match an :nth-* selector for which we walk more than 32 siblings. The number 32 were proposed in the bug report, and it turns out to be quite suitable given the experiments which were done comparing the implementation not using a cache at all, and the implementation where we cached regardlessly. We trigger caching for nth-of-type indices based on the sibling count as well, but not the sibling-of-type count as that would cause terrible performance if the elements of the same type were sparse compared to other siblings. Gives a > 40% performance improvement for [1]. [1] blink_perf.css:PseudoClassSelectors. BUG=483338 TEST=blink_perf.css:PseudoClassSelectors Committed: https://crrev.com/4b3bb3fcc9a3e6a9248cd4592e4f1f61a6462cf8 Cr-Commit-Position: refs/heads/master@{#374356}

Patch Set 1 #

Patch Set 2 : Rebased #

Total comments: 8

Patch Set 3 : Renamed constant #

Unified diffs Side-by-side diffs Delta from patch set Stats (+172 lines, -133 lines) Patch
M third_party/WebKit/Source/core/css/SelectorChecker.cpp View 1 4 chunks +4 lines, -48 lines 0 comments Download
M third_party/WebKit/Source/core/dom/NthIndexCache.h View 2 chunks +14 lines, -34 lines 0 comments Download
M third_party/WebKit/Source/core/dom/NthIndexCache.cpp View 1 2 6 chunks +154 lines, -51 lines 0 comments Download

Messages

Total messages: 21 (7 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1655993005/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1655993005/1
4 years, 10 months ago (2016-02-02 16:11:45 UTC) #2
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios_rel_device_ninja on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_rel_device_ninja/builds/166734)
4 years, 10 months ago (2016-02-02 16:16:41 UTC) #4
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1655993005/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1655993005/20001
4 years, 10 months ago (2016-02-02 16:44:04 UTC) #6
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 10 months ago (2016-02-02 18:11:51 UTC) #8
rune
4 years, 10 months ago (2016-02-02 23:33:09 UTC) #9
rune
4 years, 10 months ago (2016-02-03 11:48:34 UTC) #11
rune
ping
4 years, 10 months ago (2016-02-08 13:03:32 UTC) #12
esprehn
https://codereview.chromium.org/1655993005/diff/20001/third_party/WebKit/Source/core/dom/NthIndexCache.cpp File third_party/WebKit/Source/core/dom/NthIndexCache.cpp (right): https://codereview.chromium.org/1655993005/diff/20001/third_party/WebKit/Source/core/dom/NthIndexCache.cpp#newcode34 third_party/WebKit/Source/core/dom/NthIndexCache.cpp:34: const unsigned CachedSiblingCountLimit = 32; kCachedSiblingCountLimit https://codereview.chromium.org/1655993005/diff/20001/third_party/WebKit/Source/core/dom/NthIndexCache.cpp#newcode115 third_party/WebKit/Source/core/dom/NthIndexCache.cpp:115: ASSERT(element.parentNode()); ...
4 years, 10 months ago (2016-02-08 21:19:08 UTC) #13
rune
https://codereview.chromium.org/1655993005/diff/20001/third_party/WebKit/Source/core/dom/NthIndexCache.cpp File third_party/WebKit/Source/core/dom/NthIndexCache.cpp (right): https://codereview.chromium.org/1655993005/diff/20001/third_party/WebKit/Source/core/dom/NthIndexCache.cpp#newcode34 third_party/WebKit/Source/core/dom/NthIndexCache.cpp:34: const unsigned CachedSiblingCountLimit = 32; On 2016/02/08 21:19:07, esprehn ...
4 years, 10 months ago (2016-02-08 23:42:14 UTC) #14
rune
https://codereview.chromium.org/1655993005/diff/20001/third_party/WebKit/Source/core/dom/NthIndexCache.cpp File third_party/WebKit/Source/core/dom/NthIndexCache.cpp (right): https://codereview.chromium.org/1655993005/diff/20001/third_party/WebKit/Source/core/dom/NthIndexCache.cpp#newcode34 third_party/WebKit/Source/core/dom/NthIndexCache.cpp:34: const unsigned CachedSiblingCountLimit = 32; On 2016/02/08 23:42:14, rune ...
4 years, 10 months ago (2016-02-09 08:24:57 UTC) #15
esprehn
lgtm
4 years, 10 months ago (2016-02-09 09:37:58 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1655993005/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1655993005/40001
4 years, 10 months ago (2016-02-09 09:49:23 UTC) #18
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 10 months ago (2016-02-09 12:06:35 UTC) #19
commit-bot: I haz the power
4 years, 10 months ago (2016-02-09 12:08:45 UTC) #21
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/4b3bb3fcc9a3e6a9248cd4592e4f1f61a6462cf8
Cr-Commit-Position: refs/heads/master@{#374356}

Powered by Google App Engine
This is Rietveld 408576698