Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
xxhashbench/ | H | 14-Nov-2019 | - | 180 | 167 | |
xxhsum/ | H | 14-Nov-2019 | - | 53 | 46 | |
.travis.yml | H A D | 14-Nov-2019 | 110 | 9 | 8 | |
README.md | H A D | 14-Nov-2019 | 2 KiB | 68 | 49 | |
go.mod | H A D | 14-Nov-2019 | 45 | 4 | 2 | |
xxhash.go | H A D | 14-Nov-2019 | 5.3 KiB | 237 | 184 | |
xxhash_amd64.go | H A D | 14-Nov-2019 | 220 | 14 | 3 | |
xxhash_amd64.s | H A D | 14-Nov-2019 | 3.5 KiB | 216 | 137 | |
xxhash_other.go | H A D | 14-Nov-2019 | 1.5 KiB | 77 | 60 | |
xxhash_safe.go | H A D | 14-Nov-2019 | 392 | 16 | 7 | |
xxhash_test.go | H A D | 14-Nov-2019 | 4 KiB | 163 | 142 | |
xxhash_unsafe.go | H A D | 14-Nov-2019 | 1.4 KiB | 47 | 21 | |
xxhash_unsafe_test.go | H A D | 14-Nov-2019 | 402 | 25 | 20 |
README.md
1# xxhash 2 3[![GoDoc](https://godoc.org/github.com/cespare/xxhash?status.svg)](https://godoc.org/github.com/cespare/xxhash) 4[![Build Status](https://travis-ci.org/cespare/xxhash.svg?branch=master)](https://travis-ci.org/cespare/xxhash) 5 6xxhash is a Go implementation of the 64-bit 7[xxHash](http://cyan4973.github.io/xxHash/) algorithm, XXH64. This is a 8high-quality hashing algorithm that is much faster than anything in the Go 9standard library. 10 11This package provides a straightforward API: 12 13``` 14func Sum64(b []byte) uint64 15func Sum64String(s string) uint64 16type Digest struct{ ... } 17 func New() *Digest 18``` 19 20The `Digest` type implements hash.Hash64. Its key methods are: 21 22``` 23func (*Digest) Write([]byte) (int, error) 24func (*Digest) WriteString(string) (int, error) 25func (*Digest) Sum64() uint64 26``` 27 28This implementation provides a fast pure-Go implementation and an even faster 29assembly implementation for amd64. 30 31## Compatibility 32 33This package is in a module and the latest code is in version 2 of the module. 34You need a version of Go with at least "minimal module compatibility" to use 35github.com/cespare/xxhash/v2: 36 37* 1.9.7+ for Go 1.9 38* 1.10.3+ for Go 1.10 39* Go 1.11 or later 40 41I recommend using the latest release of Go. 42 43## Benchmarks 44 45Here are some quick benchmarks comparing the pure-Go and assembly 46implementations of Sum64. 47 48| input size | purego | asm | 49| --- | --- | --- | 50| 5 B | 979.66 MB/s | 1291.17 MB/s | 51| 100 B | 7475.26 MB/s | 7973.40 MB/s | 52| 4 KB | 17573.46 MB/s | 17602.65 MB/s | 53| 10 MB | 17131.46 MB/s | 17142.16 MB/s | 54 55These numbers were generated on Ubuntu 18.04 with an Intel i7-8700K CPU using 56the following commands under Go 1.11.2: 57 58``` 59$ go test -tags purego -benchtime 10s -bench '/xxhash,direct,bytes' 60$ go test -benchtime 10s -bench '/xxhash,direct,bytes' 61``` 62 63## Projects using this package 64 65- [InfluxDB](https://github.com/influxdata/influxdb) 66- [Prometheus](https://github.com/prometheus/prometheus) 67- [FreeCache](https://github.com/coocood/freecache) 68