Add CSSBitset
CSSBitset is the same as a std::bitset, except it uses CSSPropertyID in its API, and has substantially (~10x) better performance when traversing the set bits for cases where few bits are set. Previous experiments has shown that the typical number of applied declarations per element is in the 10-20 range (out of a 500+ bitset), which makes this optimization relevant. There are two reasons for adding this. First, there is a need (in the near future) to interact with a CSSPropertyID-based bitset outside of the StyleCascade. Therefore it's nice to have an API which actually accepts/yields CSSPropertyIDs, to avoid noisy casting at every call- site. Second, there will be a need to traverse the bits efficiently in a situation where the common case has very few bits set. This CL replaces std::bitset with CSSBitset in CascadeMap, without using any of the capabilities which make CSSBitset special, but those capabilities will be used in the near future. Change-Id: I7080c97f784f01c4f560e9fb570443dd927b7a64 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2152370Reviewed-by:Rune Lillesveen <futhark@chromium.org> Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/master@{#760314}
Showing
Please register or sign in to comment