if your code broke because of this change, i would first like
to apologize. let me try to explain why i decided to do this
even though it would be breaking.
first, it's a v0 library. this is just a necessary condition
though not sufficient. if it were v1, i would have to do
something else. second, it turns out that the go compiler does
not optimize with arrays well. heres some benchmarks:
Fixed128/1 102MB/s ± 0% 241MB/s ± 1% +136.24%
Fixed128/2 194MB/s ± 1% 457MB/s ± 2% +135.17%
Fixed128/3 306MB/s ± 1% 717MB/s ± 0% +134.58%
Fixed128/4 398MB/s ± 0% 924MB/s ± 3% +132.31%
Fixed128/8 793MB/s ± 1% 1854MB/s ± 1% +133.88%
Fixed128/9 855MB/s ± 1% 1597MB/s ± 1% +86.83%
Fixed128/16 1.52GB/s ± 1% 2.84GB/s ± 1% +86.99%
Fixed128/17 1.37GB/s ± 0% 2.51GB/s ± 1% +83.70%
Fixed128/32 2.56GB/s ± 1% 4.58GB/s ± 9% +78.52%
Fixed128/33 2.15GB/s ± 1% 3.53GB/s ± 1% +64.34%
Fixed128/64 4.17GB/s ± 1% 6.86GB/s ± 1% +64.78%
Fixed128/65 3.61GB/s ± 1% 5.36GB/s ± 4% +48.60%
Fixed128/96 5.34GB/s ± 1% 8.01GB/s ± 0% +50.01%
Fixed128/97 4.69GB/s ± 1% 6.85GB/s ± 1% +46.10%
Fixed128/128 6.20GB/s ± 0% 9.04GB/s ± 1% +45.86%
Fixed128/129 5.42GB/s ± 1% 6.35GB/s ± 1% +17.19%
Fixed128/240 6.94GB/s ± 1% 7.85GB/s ± 1% +13.11%
some of those speedups are absolutely massive. i went through
great lengths to get even 10% speedups before. third, one of
the main criterias of a good hash function is speed. assuming
two hash functions do an equally good job at their core
competency of hashing, speed is the most important feature.
otherwise, we'd just use some cryptographic hash function and
call it a day. so given that, i'm assuming that users of this
library would happily make small fixes to get that performance
improvement. indeed, a local fix could be applied by changing
res := xxh3.Hash128(someBytes)
to
resTmp := xxh3.Hash128(someBytes)
res := [2]uint64{resTmp.Hi, resTmp.Lo}
and if i could ship this change with a gofix to do that, i would.
anyway, sorry again. i hope you agree that it was worth it. all
approximately 5 of you at the time of this commit according to
deps.dev.