Add a simple benchmark for Scratch

This commit is contained in:
Bjørn Erik Pedersen 2016-03-24 15:05:40 +01:00
parent 7c84e6b3e3
commit b5bced1db4

View file

@ -143,3 +143,12 @@ func TestScratchGetSortedMapValues(t *testing.T) {
t.Errorf("Should not return anything, but got %v", nothing) t.Errorf("Should not return anything, but got %v", nothing)
} }
} }
func BenchmarkScratchGet(b *testing.B) {
scratch := newScratch()
scratch.Add("A", 1)
b.ResetTimer()
for i := 0; i < b.N; i++ {
scratch.Get("A")
}
}