-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Hash algorithm (for hashmap, strings, etc.) #3521
Comments
It uses Java's hash function, which is pretty battle tested :) |
I suppose you're referring to As I wrote, I'd also like to see |
We have been working on putting wyhash in the hashmap. It currently uses FNV1a, but if wyhash provides an improvement it will naturally be the hash-function in the hashmap. And I agree, dbj2 hash (the current string hash) should not used. It has a lot of collisions and biased hashes. |
The hashmap is now using wyhash4 as the default hash-function a14a5fb. This issue can be closed. |
One small change from the hash author making it few percent faster: rurban/smhasher#96 (comment) |
Feel free to update wyhash as the newest version solves one potential security issue and is even a tiny bit faster than the previous versions 😉. |
We are working on it 🙂 |
No need to hurry - it's just a reminder to not forget about it before next release. |
New version of wyhash got released (it shall fix the bad seeds issue and couple of others). See also #9553 (comment) and rurban/smhasher#243 . |
There was a request to use a better hash function for strings. I don't think it's necessary, but for a hashmap, it already matters a lot. There are also other possible use cases in V as well as just having a high quality (passes SMHasher and other tests) hash function standalone in V lib (maybe a template for strings, ints, floats, and arrays of all these primitive types).
I was waiting with this request for half a year to let the best known hash function (which passes all the quality criteria incl. speed) mature. I think time came, so let me introduce wyhash v4. I'm not sure though how the V variant will perform as if there won't be any intrinsics used (e.g. through conditional compilation
$if ! js { /* let's use intrinsics */ }
), the speed will unnecessarily degrade.The text was updated successfully, but these errors were encountered: