https://github.com/lithdew/cuckoo
A fast, vectorized Cuckoo filter implementation in Go. Zero allocations in hot paths with zero-copy binary representation.
https://github.com/lithdew/cuckoo
binary cuckoo-filter golang
Last synced: 9 months ago
JSON representation
A fast, vectorized Cuckoo filter implementation in Go. Zero allocations in hot paths with zero-copy binary representation.
- Host: GitHub
- URL: https://github.com/lithdew/cuckoo
- Owner: lithdew
- License: mit
- Created: 2020-04-06T10:42:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-07T08:52:49.000Z (over 6 years ago)
- Last Synced: 2025-04-23T22:03:59.069Z (about 1 year ago)
- Topics: binary, cuckoo-filter, golang
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 15
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cuckoo
[](LICENSE)
[](https://pkg.go.dev/github.com/lithdew/cuckoo)
[](https://discord.gg/58dJzS)
A fast, vectorized Cuckoo filter implementation in Go with zero allocations in hot paths and in encoding to/decoding from its in-memory representation.
Out-of-the-box, cuckoo comes with nice defaults for the purposes of state reconciliation across a distributed system. Though, feel free to configure the total number of buckets/number of bytes per bucket in [filter.go](filter.go) to taste for your specific application.
Refer to [filter_test.go](filter_test.go) for usage instructions.
## Benchmarks
```
go test -bench=. -benchtime=10s -benchmem
goos: linux
goarch: amd64
pkg: github.com/lithdew/cuckoo
BenchmarkNewFilter-8 39187 290737 ns/op 2105346 B/op 1 allocs/op
BenchmarkInsert-8 239464290 51.8 ns/op 0 B/op 0 allocs/op
BenchmarkLookup-8 238444526 49.7 ns/op 0 B/op 0 allocs/op
BenchmarkMarshalBinary-8 24799 468098 ns/op 2097161 B/op 1 allocs/op
BenchmarkUnsafeUnmarshalBinary-8 6715 2097175 ns/op 2105777 B/op 5 allocs/op
BenchmarkUnmarshalBinary-8 5738 2042495 ns/op 2105777 B/op 5 allocs/op
```