Struct selectors::parser::AncestorHashes [−][src]
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
impl AncestorHashes
[src]
impl AncestorHashes
[src]pub fn new<Impl: SelectorImpl>(
selector: &Selector<Impl>,
quirks_mode: QuirksMode
) -> Self where
Impl::Identifier: PrecomputedHash,
Impl::LocalName: PrecomputedHash,
Impl::NamespaceUrl: PrecomputedHash,
[src]
selector: &Selector<Impl>,
quirks_mode: QuirksMode
) -> Self where
Impl::Identifier: PrecomputedHash,
Impl::LocalName: PrecomputedHash,
Impl::NamespaceUrl: PrecomputedHash,
pub fn fourth_hash(&self) -> u32
[src]
Returns the fourth hash, reassembled from parts.
Trait Implementations
impl Clone for AncestorHashes
[src]
impl Clone for AncestorHashes
[src]fn clone(&self) -> AncestorHashes
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Eq for AncestorHashes
[src]
impl Eq for AncestorHashes
[src]impl PartialEq<AncestorHashes> for AncestorHashes
[src]
impl PartialEq<AncestorHashes> for AncestorHashes
[src]fn eq(&self, other: &AncestorHashes) -> bool
[src]
fn ne(&self, other: &AncestorHashes) -> bool
[src]
impl StructuralEq for AncestorHashes
[src]
impl StructuralEq for AncestorHashes
[src]impl StructuralPartialEq for AncestorHashes
[src]
impl StructuralPartialEq for AncestorHashes
[src]Auto Trait Implementations
impl RefUnwindSafe for AncestorHashes
impl RefUnwindSafe for AncestorHashes
impl Send for AncestorHashes
impl Send for AncestorHashes
impl Sync for AncestorHashes
impl Sync for AncestorHashes
impl Unpin for AncestorHashes
impl Unpin for AncestorHashes
impl UnwindSafe for AncestorHashes
impl UnwindSafe for AncestorHashes