Closed coderedart closed 1 month ago
I think I used an old intel CPU on windows for old benchmarks, the numbers are 7 years old at this point :) So if you used a newer CPU or another OS the numbers can differ a lot. Rust also changed the implementation of the standard hashmap to hashbrown variant if I remember correctly. I have been thinking of removing them altogether as performance will vary a lot between architectures and OSs. Always benchmark on your intended hardware with representative data if performance is important.
Seems adding ahash and hashbrown bumps minimum rustc version. I don't see a reason to do this just for benchmarks as there might be users who are still on an older rustc version. Instead I will add a benchmark branch and merge your changes there.
I wanted to add
ahash
andno-op
hashes to check how they perform relatively. I knowno-op
is not exactly a hash, but there are common cases where the keys are already random. The best example is probablystd::any::TypeId
which is used in bevy and many other libraries like egui or flecs-rs.I also added
HashBrownMap
as it seems to be popular and serves as an alternative to std. It usesahash
by default at this moment.cargo +nightly bench
I got the following resultsI don't know if I am doing something wrong, or maybe stdlib got better over time, but the README's measurements definitely don't reflect the current status.
It would nice if you could run the benchmarks yourself and update the README. It will help users take a more informed decision on whether intmap would be suitable for their usecase or not.