Closed chennqqi closed 6 years ago
Those benchmarks don't come from this package, they come from github.com/alecthomas/mph.
My package also has benchmarks that compare it against the stdlib map and the last time I ran them, mph was faster in that benchmark, though I haven't run it recently.
FWIW, the MPH implementation in this package does seem faster than a map[string]uint32
, though the gap has closed somewhat:
$ go test -bench Table -benchtime 10s
goos: linux
goarch: amd64
pkg: github.com/cespare/mph
BenchmarkTable 300000000 48.6 ns/op
BenchmarkTableMap 200000000 67.6 ns/op
goos: linux goarch: amd64 pkg: github.com/alecthomas/mph BenchmarkBuiltinMap-40 10000000 144 ns/op BenchmarkCHD-40 10000000 205 ns/op