Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Use fnv hasher #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Use fnv hasher #43

wants to merge 1 commit into from

Conversation

greyblake
Copy link

Hey, I just watched your talk and you mentioned there, that you use BTreeMap and I thought I can try to contribute to make it a little bit faster.

This PR replaces BTreeMap with HashMap with fnv hasher. As far as I know it's probably the fastest available HashMap option in Rust world. Once I improved speed of whatlang by ~30% just replacing standard (default) HashMap hasher with fnv.

Regarding benchmarks: it looks like most of them got better, but some got worse. Please double check yourself if the change really makes sense.

Also if you have particular reasons to prefer BTreeMap instead of HashMap (e.g. you care about order), please feel free to reject this PR. But if so you have to reflect this fact in your tests, because they're still green ;)

@greyblake
Copy link
Author

@mre Haha, you mentioned this PR today, but it never got merged :)

@mre
Copy link
Owner

mre commented Mar 25, 2021

Oh yeah. I think the reason is that I never got around to benchmarking the change myself. If there is no noticeable perf-improvement I'd opt for keeping the BTreeMap impl as it's part of std, so we have one less "third-party dependency".
Then again the project is not very active anymore anyway and https://github.com/ijl/orjson is very likely the better choice for new projects. So perhaps we want to close the PR?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants