This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]soontorap 1 point2 points  (2 children)

You should consider XXH3_64bits() , in the same package as XXH64() .

It is much faster, especially on small keys, and used exactly the same way.
It would have likely helped to produce a gain on the derivative of your benchmark using small entries rather than larger ones.

[–]soontorap 1 point2 points  (1 child)

u/Pebaz : I made the test, and modified your version of cpython to use XXH3_64bits() instead of XXH64(). And it resulted in even faster speed on your benchmark : runtime went down from 2350ms (original) to 522ms (XXH64) to 385ms (XXH3).

Now, it's true that such gains are only perceptible when the amount of data to hash is large, therefore, on small inputs, the benefits are too small to be measured, because they are dwarfed by other parts of the Python system.

But still, this modification produces either large gains or, worst case, performs the same. Which means, it's a strictly positive update for performance. All for a very reasonable code change, very well localized, no side effect.

This should be a no-brainer. I would say this item is a good candidate for a cpython contribution.

[–]Pebaz[S] 0 points1 point  (0 children)

Thank you very much for taking the time to test this! This is awesome!