Struct selectors::parser::AncestorHashes
source · pub struct AncestorHashes {
pub packed_hashes: [u32; 3],
}
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<Impl: SelectorImpl>( selector: &Selector<Impl>, quirks_mode: QuirksMode, ) -> Self
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 moresource§impl Debug for AncestorHashes
impl Debug for AncestorHashes
source§impl PartialEq for AncestorHashes
impl PartialEq for AncestorHashes
impl Eq for AncestorHashes
impl StructuralPartialEq for AncestorHashes
Auto Trait Implementations§
impl Freeze for AncestorHashes
impl RefUnwindSafe for AncestorHashes
impl Send for AncestorHashes
impl Sync for AncestorHashes
impl Unpin for AncestorHashes
impl UnwindSafe for AncestorHashes
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)