Mark []byte passed to Sum64 as noescape

The compiler cannot tell if arguments passed to an asm function escape
so it assumes that they always do. Mark arguments passed to Sum64 as
noescape so any temporary created from a []byte(string) conversion does
not escape.

% benchstat {old,new}.txt
name          old time/op    new time/op    delta
StringHash-4    80.8ns ± 4%    20.8ns ± 0%   -74.25%   (p=0.000 n=10+9)

name          old alloc/op   new alloc/op   delta
StringHash-4     16.0B ± 0%     0.0B ±NaN%  -100.00%  (p=0.000 n=10+10)

name          old allocs/op  new allocs/op  delta
StringHash-4      1.00 ± 0%     0.00 ±NaN%  -100.00%  (p=0.000 n=10+10)
2 files changed
tree: c371db9fcf57b087d90d1eb1783c4356fa3c2c01
  1. xxhsum/
  2. LICENSE.txt
  3. README.md
  4. xxhash.go
  5. xxhash_amd64.go
  6. xxhash_amd64.s
  7. xxhash_amd64_test.go
  8. xxhash_other.go
  9. xxhash_test.go
README.md

xxhash

GoDoc

xxhash is a Go implementation of the 64-bit xxHash algorithm, XXH64. This is a high-quality hashing algorithm that is much faster than anything in the Go standard library.

On amd64 there is an even faster assembly implementation that runs at over 10 GB/s on my laptop.