Struct parcel_selectors::parser::AncestorHashes
source · Expand description
Ancestor hashes for the bloom filter. We precompute these and store them inline with selectors to optimize cache performance during matching. This matters a lot.
We use 4 hashes, which is copied from Gecko, who copied it from WebKit. Note that increasing the number of hashes here will adversely affect the cache hit when fast-rejecting long lists of Rules with inline hashes.
Because the bloom filter only uses the bottom 24 bits of the hash, we pack the fourth hash into the upper bits of the first three hashes in order to shrink Rule (whose size matters a lot). This scheme minimizes the runtime overhead of the packing for the first three hashes (we just need to mask off the upper bits) at the expense of making the fourth somewhat more complicated to assemble, because we often bail out before checking all the hashes.
Fields§
§packed_hashes: [u32; 3]
Implementations§
source§impl AncestorHashes
impl AncestorHashes
pub fn new<'i, Impl: SelectorImpl<'i>>(
selector: &Selector<'i, Impl>,
quirks_mode: QuirksMode
) -> Selfwhere
Impl::Identifier: PrecomputedHash,
Impl::LocalName: PrecomputedHash,
Impl::NamespaceUrl: PrecomputedHash,
sourcepub fn fourth_hash(&self) -> u32
pub fn fourth_hash(&self) -> u32
Returns the fourth hash, reassembled from parts.
Trait Implementations§
source§impl Clone for AncestorHashes
impl Clone for AncestorHashes
source§fn clone(&self) -> AncestorHashes
fn clone(&self) -> AncestorHashes
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more