...
1# xxhash
2
3[](https://godoc.org/github.com/cespare/xxhash)
4
5xxhash is a Go implementation of the 64-bit
6[xxHash](http://cyan4973.github.io/xxHash/) algorithm, XXH64. This is a
7high-quality hashing algorithm that is much faster than anything in the Go
8standard library.
9
10The API is very small, taking its cue from the other hashing packages in the
11standard library:
12
13 $ go doc github.com/cespare/xxhash !
14 package xxhash // import "github.com/cespare/xxhash"
15
16 Package xxhash implements the 64-bit variant of xxHash (XXH64) as described
17 at http://cyan4973.github.io/xxHash/.
18
19 func New() hash.Hash64
20 func Sum64(b []byte) uint64
21 func Sum64String(s string) uint64
22
23This implementation provides a fast pure-Go implementation and an even faster
24assembly implementation for amd64.
25
26## Benchmarks
27
28Here are some quick benchmarks comparing the pure-Go and assembly
29implementations of Sum64 against another popular Go XXH64 implementation,
30[github.com/OneOfOne/xxhash](https://github.com/OneOfOne/xxhash):
31
32| input size | OneOfOne | cespare (purego) | cespare |
33| --- | --- | --- | --- |
34| 5 B | 416 MB/s | 720 MB/s | 872 MB/s |
35| 100 B | 3980 MB/s | 5013 MB/s | 5252 MB/s |
36| 4 KB | 12727 MB/s | 12999 MB/s | 13026 MB/s |
37| 10 MB | 9879 MB/s | 10775 MB/s | 10913 MB/s |
38
39These numbers were generated with:
40
41```
42$ go test -benchtime 10s -bench '/OneOfOne,'
43$ go test -tags purego -benchtime 10s -bench '/xxhash,'
44$ go test -benchtime 10s -bench '/xxhash,'
45```
46
47## Projects using this package
48
49- [InfluxDB](https://github.com/influxdata/influxdb)
50- [Prometheus](https://github.com/prometheus/prometheus)
View as plain text