Use ahash as default hasher.

This commit is contained in:
Stephen Chung 2021-01-15 23:52:56 +08:00
parent 1c7884f0d8
commit c4b6c31bf0
2 changed files with 2 additions and 14 deletions

View File

@ -24,7 +24,7 @@ categories = [ "no-std", "embedded", "wasm", "parser-implementations" ]
[dependencies]
smallvec = { version = "1.4", default-features = false }
fxhash = { version = "0.2" }
ahash = { version = "0.3.2", default-features = false, features = ["compile-time-rng"] }
rhai_codegen = { version = "0.3", path = "codegen" }
[features]
@ -46,7 +46,7 @@ unicode-xid-ident = ["unicode-xid"] # allow Unicode Standard Annex #31 for ident
metadata = [ "serde", "serde_json"] # enables exporting functions metadata to JSON
# compiling for no-std
no_std = [ "smallvec/union", "num-traits/libm", "hashbrown", "core-error", "libm", "ahash" ]
no_std = [ "smallvec/union", "num-traits/libm", "hashbrown", "core-error", "libm" ]
[profile.release]
lto = "fat"
@ -76,12 +76,6 @@ default-features = false
features = ["ahash", "nightly", "inline-more"]
optional = true
[dependencies.ahash]
version = "0.3.2"
default-features = false
features = ["compile-time-rng"]
optional = true
[dependencies.serde]
version = "1.0.116"
default_features = false

View File

@ -59,13 +59,7 @@ impl BuildHasher for StraightHasherBuilder {
/// Create an instance of the default hasher.
#[inline(always)]
pub fn get_hasher() -> impl Hasher {
#[cfg(feature = "no_std")]
let s: ahash::AHasher = Default::default();
// #[cfg(not(feature = "no_std"))]
// let s = crate::stdlib::collections::hash_map::DefaultHasher::new();
#[cfg(not(feature = "no_std"))]
let s: fxhash::FxHasher64 = Default::default();
s
}