From e40b1d42fa826f56c365e2bed2eb8673936dd7a0 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 26 Nov 2019 17:17:20 -0500 Subject: [PATCH] Use wyhash over fxhash --- Cargo.lock | 20 ++++++++++---------- Cargo.toml | 2 +- src/collections.rs | 6 +++--- src/lib.rs | 2 +- stdlib/src/lib.rs | 8 ++++---- stdlib/src/map.rs | 6 +++--- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4208226aaa..3084dc55e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -356,14 +356,6 @@ dependencies = [ "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "getrandom" version = "0.1.13" @@ -1192,7 +1184,6 @@ version = "0.1.0" dependencies = [ "bumpalo 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "fraction 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "im-rc 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "indoc 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "inkwell 0.1.0 (git+https://github.com/TheDan64/inkwell?branch=llvm8-0)", @@ -1203,6 +1194,7 @@ dependencies = [ "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.8.5 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck_macros 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wyhash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1692,6 +1684,14 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wyhash" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [metadata] "checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" "checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" @@ -1739,7 +1739,6 @@ dependencies = [ "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" "checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" -"checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" "checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407" "checksum h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" "checksum hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "307c3c9f937f38e3534b1d6447ecf090cafcc9744e4a6360e8b037b2cf5af120" @@ -1884,3 +1883,4 @@ dependencies = [ "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +"checksum wyhash 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "782a50f48ac4336916227cd199c61c7b42f38d0ad705421b49eb12c74c53ae00" diff --git a/Cargo.toml b/Cargo.toml index d35d7390f4..389438b46b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ petgraph = { version = "0.4.5", optional = true } im-rc = "14.0.0" fraction = "0.6.2" num = "0.2.0" -fxhash = "0.2.1" +wyhash = "0.3.0" bumpalo = "2.6.0" # NOTE: Breaking API changes get pushed directly to this Inkwell branch, so be # very careful when running `cargo update` to get a new revision into Cargo.lock. diff --git a/src/collections.rs b/src/collections.rs index 99062a9f87..3ad344c6e4 100644 --- a/src/collections.rs +++ b/src/collections.rs @@ -2,14 +2,14 @@ use bumpalo::collections::String; use bumpalo::Bump; use std::hash::BuildHasherDefault; -pub use fxhash::FxHasher; +pub use wyhash::WyHash; #[inline(always)] -pub fn default_hasher() -> BuildHasherDefault { +pub fn default_hasher() -> BuildHasherDefault { BuildHasherDefault::default() } -pub type BuildHasher = BuildHasherDefault; +pub type BuildHasher = BuildHasherDefault; // Versions of HashMap and HashSet from both std and im_rc // which use the FNV hasher instead of the default SipHash hasher. diff --git a/src/lib.rs b/src/lib.rs index f266997b07..3c409073f3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,10 +22,10 @@ pub mod unify; extern crate bumpalo; extern crate fraction; -extern crate fxhash; extern crate im_rc; extern crate inkwell; extern crate num; +extern crate wyhash; #[macro_use] extern crate log; diff --git a/stdlib/src/lib.rs b/stdlib/src/lib.rs index 92f0da0b10..7b5fd7b459 100644 --- a/stdlib/src/lib.rs +++ b/stdlib/src/lib.rs @@ -1,9 +1,9 @@ -pub mod frac; pub mod approx; +pub mod default; +pub mod frac; +pub mod int; pub mod map; pub mod set; -pub mod int; -pub mod default; extern crate im_rc; -extern crate fxhash; \ No newline at end of file +extern crate wyhash; diff --git a/stdlib/src/map.rs b/stdlib/src/map.rs index 15387c66ae..978cdc9d6d 100644 --- a/stdlib/src/map.rs +++ b/stdlib/src/map.rs @@ -1,10 +1,10 @@ use im_rc::hashmap::HashMap; use im_rc::vector::Vector; -use fxhash::FxHasher; +use wyhash::WyHash; /// A persistent HashMap which records insertion order and iterates in that order. pub struct Map { - store: HashMap>; + store: HashMap>; order: Vector } @@ -12,4 +12,4 @@ impl Map { pub fn is_empty(self) -> bool { self.store.is_empty() } -} \ No newline at end of file +}