r/programming • u/tooilln • Jul 20 '26
Comprehensive JVM Primitive Hashtable Benchmarks
https://sooniln.github.io/posts/hashmap-benchmarks-2026/
45
Upvotes
r/programming • u/tooilln • Jul 20 '26
View all comments
Show parent comment
2
u/n4te Jul 20 '26 edited Jul 20 '26
Sure, here is IntIntMap. It could be extracted into a standalone class pretty easily, or grab a libgdx JAR. That utils package has other maps, like IntFloatMap, but there's currently no IntLongMap (it'd just be a matter of copy/paste and fix up).
If you're curious about cuckoo hashing, the last IntIntMap version that used it can be found here. It works, but very unlucky or maliciously crafted keys can OOM (more info here). Still, cuckoo hashing has interesting properties and is quite different from other approaches.
For certain use cases, a minimal perfect hash is a neat approach.