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]
Methods
impl AncestorHashes
[src]
pub fn new<Impl: SelectorImpl>(
selector: &Selector<Impl>,
quirks_mode: QuirksMode
) -> Self
[src]
selector: &Selector<Impl>,
quirks_mode: QuirksMode
) -> Self
pub fn fourth_hash(&self) -> u32
[src]
Returns the fourth hash, reassembled from parts.
Trait Implementations
impl Clone for AncestorHashes
[src]
fn clone(&self) -> AncestorHashes
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for AncestorHashes
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Eq for AncestorHashes
[src]
impl MallocSizeOf for AncestorHashes
[src]
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
[src]
Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. Read more
impl PartialEq for AncestorHashes
[src]
fn eq(&self, __arg_0: &AncestorHashes) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &AncestorHashes) -> bool
[src]
This method tests for !=
.