Struct selectors::parser::AncestorHashes[][src]

pub struct AncestorHashes {
    pub packed_hashes: [u32; 3],
}

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]

pub fn new<Impl: SelectorImpl>(
    selector: &Selector<Impl>,
    quirks_mode: QuirksMode
) -> Self where
    Impl::Identifier: PrecomputedHash,
    Impl::LocalName: PrecomputedHash,
    Impl::NamespaceUrl: PrecomputedHash
[src]

pub fn fourth_hash(&self) -> u32[src]

Returns the fourth hash, reassembled from parts.

Trait Implementations

impl Clone for AncestorHashes[src]

impl Debug for AncestorHashes[src]

impl Eq for AncestorHashes[src]

impl PartialEq<AncestorHashes> for AncestorHashes[src]

impl StructuralEq for AncestorHashes[src]

impl StructuralPartialEq for AncestorHashes[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.