Use wyhash over fxhash

This commit is contained in:
Richard Feldman 2019-11-26 17:17:20 -05:00
parent 25cd967cee
commit e40b1d42fa
6 changed files with 22 additions and 22 deletions

20
Cargo.lock generated
View file

@ -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"

View file

@ -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.

View file

@ -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<FxHasher> {
pub fn default_hasher() -> BuildHasherDefault<WyHash> {
BuildHasherDefault::default()
}
pub type BuildHasher = BuildHasherDefault<FxHasher>;
pub type BuildHasher = BuildHasherDefault<WyHash>;
// Versions of HashMap and HashSet from both std and im_rc
// which use the FNV hasher instead of the default SipHash hasher.

View file

@ -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;

View file

@ -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;
extern crate wyhash;

View file

@ -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<K, V> {
store: HashMap<K, V, BuildHasherDefault<FxHasher>>;
store: HashMap<K, V, BuildHasherDefault<WyHash>>;
order: Vector<K>
}