Skip to content

realzeitmedia/fnv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Go FNV64a hash

This avoids allocations compared to hash/fnv from the standard library: No []byte allocation when hashing strings, and no allocation of the hash interface.

$ go test -bench=. -benchmem
PASS
BenchmarkStringsStdlib-4	20000000	        87.5 ns/op	      16 B/op	       1 allocs/op
BenchmarkStrings-4      	50000000	        33.0 ns/op	       0 B/op	       0 allocs/op
ok  	github.com/realzeitmedia/fnv	3.540s

See example_test.go for usage.

Installation:

`go get github.com/realzeitmedia/fnv`