forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 Review URL: https://codereview.chromium.org/1655993005 Cr-Commit-Position: refs/heads/master@{#374356}
- Loading branch information
rune
authored and
Commit bot
committed
Feb 9, 2016
1 parent
7808ebe
commit 4b3bb3f
Showing
3 changed files
with
172 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.