Module style::bloom

source · []
Expand description

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

Structs

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.

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