diff options
author | Oriol Brufau <obrufau@igalia.com> | 2023-05-16 23:20:00 +0200 |
---|---|---|
committer | Oriol Brufau <obrufau@igalia.com> | 2023-05-16 23:40:23 +0200 |
commit | e23a8bf0ad5fcfc23395b74dccb571fe360ee0bb (patch) | |
tree | 29d93077cab51f4c297482cb7f2fa9afbaf2dced /components/style/gecko/selector_parser.rs | |
parent | a7ca8022d3db119a77afdba6bdb70b82a90c58ac (diff) | |
download | servo-e23a8bf0ad5fcfc23395b74dccb571fe360ee0bb.tar.gz servo-e23a8bf0ad5fcfc23395b74dccb571fe360ee0bb.zip |
style: Add attribute names to the bloom filter
Safari does this. This reduces the runtime in the example linked from
comment 0 quite a lot (40ms on a local opt build, from ~130ms on a
release nightly build).
I added a pref because there's a slight chance of performance
regressions on pages that do not use attribute selectors, as we're now
doing more unconditional work per element (adding the attributes to the
bloom filter). But the trade-off should be worth it, I think.
Differential Revision: https://phabricator.services.mozilla.com/D111689
Diffstat (limited to 'components/style/gecko/selector_parser.rs')
-rw-r--r-- | components/style/gecko/selector_parser.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index a9083581234..b2fe46a9a2c 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -247,6 +247,11 @@ impl ::selectors::SelectorImpl for SelectorImpl { type PseudoElement = PseudoElement; type NonTSPseudoClass = NonTSPseudoClass; + + fn should_collect_attr_hash(name: &AtomIdent) -> bool { + static_prefs::pref!("layout.css.bloom-filter-attribute-names.enabled") && + !crate::bloom::is_attr_name_excluded_from_filter(name) + } } impl<'a> SelectorParser<'a> { |