Skip to content

cespare/mph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mph

Go Reference

mph is a Go package for that implements a minimal perfect hash table over strings. It uses the "Hash, displace, and compress" algorithm and the Murmur3 hash function.

Some quick benchmark results (this is on an i7-8700K):

  • Build constructs a minimal perfect hash table from a 102k word dictionary in 18ms (construction time is linear in the size of the input).

  • Lookups on that dictionary take about 30ns and are 27% faster than a map[string]uint32:

    BenchmarkTable-12               199293806               29.99 ns/op
    BenchmarkTableMap-12            145449822               40.92 ns/op
    

About

Minimal perfect hashing in Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages