-
Committer:
John Arbash Meinel
-
Date:
2011-06-12 13:44:51 UTC
-
Revision ID:
john@arbash-meinel.com-20110612134451-580mfvg5pcubf3cy
Restoring to unsafe.Pointer as-you-go.
Interestingly, if you change the C code to create uint64 by
performing 8 SHIFT & OR functions, you end up at 132us.
So the 'unsafe.Pointer' trick of treating the byte array
as a simple uint64 really does save a lot of time.
Which makes sense, given that the actual hashing is only a
few shift, multiply and xor calls itself.
Next trick to try, write ASM code for rotates, instead of
actually using shifts.
Only thing is, the gcc super-fast version from here:
http://linux.derkeiler.com/Mailing-Lists/Kernel/2005-06/att-4540/4.rot64.patch
Makes heavy use of the ability to inline and have the compiler
pick which branch it will inline, since the actual shift is
a constant...