-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: switch jaq-json hasher to foldhash #237
Conversation
Hi @tranzystorekk, thanks for your PR! I ran a quick benchmark:
The most relevant ones are probably "kv*", and we see very little difference there. I'm a bit divided about this change: Having fewer dependencies is always nice. :) However, the given hasher shows up in the public API of As evidence for the Rust ecosystem shifting to I also did not test Just throwing in an idea: While looking at I tend to be more conservative with jaq changing dependencies nowadays. Intuitively, I would not change the hasher right now, but let me think a bit about it. |
Since both hashbrown and rustc have switched to foldhash, I'm quite convinced that it's suitable for general-purpose, but fast hashing. As noted in my comparison that you found, rustc uses a variant of foldhash which simplifies it for the data typical to a compiler and it even improves upon the old FxHash. I've switched to foldhash in my projects. As for your concern about dependencies, I think the |
Thanks for your input, @thaliaarchi. I have thus decided to use |
This change replaces the hasher used in
jaq-json
withfoldhash
.My personal motivation is that
foldhash
seems to be entering the ecosystem as an upcoming state-of-the-art, but there are other considerations:ahash
way back in 0.5.0 was 6114f30 and nowfoldhash
has zero runtime dependencies, which allows droppingzerocopy
fromCargo.lock
foldhash
is at worst comparable toahash
, so no apparent perf harm in the replacementI am aware that this change might feel insubstantial or arbitrary, so please treat it as a loose suggestion and feel free to close immediately if uninterested :)