I want to hash 64 bit integers only. I am using the implementation of murmurhash3 given here. Can there be some improvements in the code given this constraint. I am not able to figure it out completely but I think that the the for loop at line 171 might be the target.
Please suggest something on this.
I want to hash 64 bit integers only. I am using the implementation of
Share
If you need only hash 64bit numbers, then use the numbers value, cause all murmur3 will do is waste CPU cycles mixing the same input number to the same output number, the only exception is if you are changing the seed.
if you really want to optimize for a fixed size, you can copy the function, and just slightly alter it (allowing the compilers constant propagation and constant folding to do the heavy lifting):
if you are using C++ at any later stage, it would make sense to turn this into a template along the lines of:
Also note, that some smarter compilers (ICC, MSVC, GCC) will detect if the function is only ever called with the same constant arguments (including partly constant argument lists) and fold those constants into the function (this requires the “whole program optimization” option to be enabled)