mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Convert FnvHash{Set,Map} instances to FxHash{Set,Map}.
Bug: 1477628 Reviewed-by: heycam
This commit is contained in:
parent
0cab212052
commit
fc9df0bcf3
18 changed files with 49 additions and 44 deletions
|
@ -25,6 +25,7 @@ matches = "0.1"
|
|||
cssparser = "0.24.0"
|
||||
log = "0.4"
|
||||
fnv = "1.0"
|
||||
fxhash = "0.2"
|
||||
phf = "0.7.18"
|
||||
precomputed-hash = "0.1"
|
||||
servo_arc = { version = "0.1", path = "../servo_arc" }
|
||||
|
|
|
@ -297,6 +297,9 @@ impl Clone for BloomStorageBool {
|
|||
}
|
||||
|
||||
fn hash<T: Hash>(elem: &T) -> u32 {
|
||||
// We generally use FxHasher in Stylo because it's faster than FnvHasher,
|
||||
// but the increased collision rate has outsized effect on the bloom
|
||||
// filter, so we use FnvHasher instead here.
|
||||
let mut hasher = FnvHasher::default();
|
||||
elem.hash(&mut hasher);
|
||||
let hash: u64 = hasher.finish();
|
||||
|
|
|
@ -10,6 +10,7 @@ extern crate bitflags;
|
|||
#[macro_use]
|
||||
extern crate cssparser;
|
||||
extern crate fnv;
|
||||
extern crate fxhash;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use fnv::FnvHashMap;
|
||||
use fxhash::FxHashMap;
|
||||
use tree::OpaqueElement;
|
||||
|
||||
/// A cache to speed up matching of nth-index-like selectors.
|
||||
|
@ -32,7 +32,7 @@ impl NthIndexCache {
|
|||
|
||||
/// The concrete per-pseudo-class cache.
|
||||
#[derive(Default)]
|
||||
pub struct NthIndexCacheInner(FnvHashMap<OpaqueElement, i32>);
|
||||
pub struct NthIndexCacheInner(FxHashMap<OpaqueElement, i32>);
|
||||
|
||||
impl NthIndexCacheInner {
|
||||
/// Does a lookup for a given element in the cache.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue