Skip to content

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

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages