mirror of
https://github.com/swc-project/swc.git
synced 2024-12-22 05:01:42 +03:00
db60291164
Description: - To avoid a breaking change, I created a cargo feature that can be used to change hasher. - This leads to about 8% perf improvements on m1 max macbook pro 64gb
28 lines
636 B
Rust
28 lines
636 B
Rust
#[cfg(not(feature = "perf"))]
|
|
pub use self::ahash::*;
|
|
#[cfg(feature = "perf")]
|
|
pub use self::fxhash::*;
|
|
|
|
#[cfg(feature = "perf")]
|
|
mod fxhash {
|
|
use std::{
|
|
collections::{HashMap, HashSet},
|
|
hash::BuildHasherDefault,
|
|
};
|
|
|
|
use rustc_hash::FxHasher;
|
|
|
|
pub type AHashMap<K, V> = HashMap<K, V, BuildHasherDefault<FxHasher>>;
|
|
|
|
pub type AHashSet<V> = HashSet<V, BuildHasherDefault<FxHasher>>;
|
|
}
|
|
|
|
#[cfg(not(feature = "perf"))]
|
|
mod ahash {
|
|
use std::collections::{HashMap, HashSet};
|
|
|
|
pub type AHashMap<K, V> = HashMap<K, V, ahash::RandomState>;
|
|
|
|
pub type AHashSet<V> = HashSet<V, ahash::RandomState>;
|
|
}
|