Skip to content
/ go-hll Public

An implementation of HyperLogLog written in Go

License

Notifications You must be signed in to change notification settings

vraja2/go-hll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-hll

An implementation of HyperLogLog written in Go. HyperLogLog is a cardinality estimation algorithm explained well here.

Usage

Create an HLL instance

hllInstance := NewHLLWithRegisterBits(numRegisterBits)
Note: defaults to 6 register bits if not explicitly specified

Add a value to the HLL instance

hllInstance.AddString("hello")
hllInstance.AddHash(123456)

Under the hood, AddString uses MurmurHash32 to hash the provided string into a 32 bit integer.

Get the count/cardinality of the HLL instance

count := hllInstance.Count()

Merge two HLL instances

hllInstance.Merge(otherHllInstance)

Development

Running Tests

go test

Formatting

All code is formatted with go fmt

About

An implementation of HyperLogLog written in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages