fxhash icon indicating copy to clipboard operation
fxhash copied to clipboard

What's the relation with the rustc-hash crate?

Open Apanatshka opened this issue 5 years ago • 2 comments

I've noticed that FxHash(Map/Set) is also available in https://github.com/rust-lang/rustc-hash. How do the two crates relate? It looks like the same name/description. Which one should be preferred?

Apanatshka avatar Sep 24 '19 18:09 Apanatshka

They both use the same hashing mechanism: self.hash.rotate_left(5).bitxor(i).wrapping_mul(K); With a quick glance, it looks like the only difference is that this crate provides a 32 and 64 bit variant (ignoring the target platform). I think I needed that because procedural macros was detecting the current platform as the target platform, so I needed to swap out FxHash with FxHash32/64 within the procedural macro.

Otherwise, I'd probably prefer rustc-hash for it's simplicity (and they will probably maintain it :P).

cbreeden avatar Sep 30 '19 03:09 cbreeden

Cool, then I'll use the rustc-hash crate I guess :) Perhaps this is something to add to the crate README?

Apanatshka avatar Sep 30 '19 12:09 Apanatshka