DescriptionOnly 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 #
Messages
Total messages: 21 (7 generated)
|