Module bloom

Source
Expand description

The style bloom filter is used as an optimization when matching deep descendant selectors.

Structsยง

PushedElement ๐Ÿ”’
StyleBloom
A struct that allows us to fast-reject deep descendant selectors avoiding selector-matching.

Constantsยง

BLOOM_KEY ๐Ÿ”’
Bloom filters are large allocations, so we store them in thread-local storage such that they can be reused across style traversals. StyleBloom is responsible for ensuring that the bloom filter is zeroed when it is dropped.
MEMSET_CLEAR_THRESHOLD ๐Ÿ”’
The very rough benchmarks in the selectors crate show clear() costing about 25 times more than remove_hash(). We use this to implement clear() more efficiently when only a small number of hashes have been pushed.

Functionsยง

each_relevant_element_hash
Gather all relevant hash for fast-reject filters from an element.
is_attr_name_excluded_from_filter
Returns whether the attribute name is excluded from the bloom filter.