Skip to content

Instantly share code, notes, and snippets.

@skanehira
Last active December 28, 2020 07:28
Show Gist options
  • Save skanehira/b0fa0b0ab93fc1c75c2cb8c92de81e69 to your computer and use it in GitHub Desktop.
Save skanehira/b0fa0b0ab93fc1c75c2cb8c92de81e69 to your computer and use it in GitHub Desktop.
package main
import "testing"
func BenchmarkMapStruct(b *testing.B) {
m := map[int]interface{}{
0: 0,
}
for i := 0; i < b.N; i++ {
_ = m[0]
}
}
func BenchmarkMapBool(b *testing.B) {
m := map[int]bool{
0: false,
}
for i := 0; i < b.N; i++ {
_ = m[0]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment