Closed smira closed 5 years ago
👍
@spaolacci any feedback from you?
Sorry for the more than late answer. I can't observe the allocation anymore as of Go 1.12 at least - I guess escape analysis eventually found it somewhere in the between - but those two references are intentionally useless, so better without them.
I did run a more comprehensive allocation check. All the regular calls are zero allocation, streaming hashers are exactly one allocation.
This extra reference isn't really required as this object should be anyway allocated on the stack.
I wasn't able to reproduce it with micro-benchmarks for murmur3, but with bigger library I'm working on this leads to one extra memory allocation when slice passed to
Sum128()
is taken from byte array.Performance improvement is small, but noticeable for smaller slices (that's for
Benchmark128
):