Skip to content

Instantly share code, notes, and snippets.

@derekcollison
Last active December 17, 2015 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derekcollison/5685672 to your computer and use it in GitHub Desktop.
Save derekcollison/5685672 to your computer and use it in GitHub Desktop.
Go 1.1 Map performance.
Impressed with the performance gains in go 1.1 on maps. I had to write my own for the original gnatsd.
HashMap is my own implementation.
go 1.0.3
~/Development/go/src/github.com/apcera/gnatsd/hashmap> go test --bench="."
PASS
Benchmark_GoMap___GetSmallKey 50000000 53.1 ns/op 18.82 MB/s
Benchmark_HashMap_GetSmallKey 10000000 21.4 ns/op 46.69 MB/s
Benchmark_GoMap____GetMedKey 20000000 107 ns/op 9.27 MB/s
Benchmark_HashMap__GetMedKey 50000000 34.7 ns/op 28.78 MB/s
Benchmark_HashMap_______Set 10000000 141 ns/op 7.05 MB/s
ok github.com/apcera/gnatsd/hashmap 10.518s
go 1.1
~/Development/go/src/github.com/apcera/gnatsd/hashmap> go test --bench="."
PASS
Benchmark_GoMap___GetSmallKey 100000000 10.0 ns/op 99.79 MB/s
Benchmark_HashMap_GetSmallKey 100000000 17.6 ns/op 56.72 MB/s
Benchmark_GoMap____GetMedKey 100000000 24.5 ns/op 40.87 MB/s
Benchmark_HashMap__GetMedKey 100000000 30.0 ns/op 33.39 MB/s
Benchmark_HashMap_______Set 20000000 99.5 ns/op 10.05 MB/s
ok github.com/apcera/gnatsd/hashmap 10.385s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment