From c4b6c31bf0b42c740b68b5d623ce76218b024f0d Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Fri, 15 Jan 2021 23:52:56 +0800 Subject: [PATCH] Use ahash as default hasher. --- Cargo.toml | 10 ++-------- src/utils.rs | 6 ------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b5396f99..89e2cca7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 diff --git a/src/utils.rs b/src/utils.rs index e92bcefa..7cbed35c 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -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 }