cmap: Remove defers (#2210)

All functions in cmap have just one code path. Thus there is not a reason
to use defer statements.
This commit is contained in:
Dev Ojha
2018-08-14 18:59:04 +04:00
committed by Anton Kaliaev
parent ed08ae7321
commit d0dcb1cde1
2 changed files with 23 additions and 10 deletions
+11
View File
@@ -51,3 +51,14 @@ func TestContains(t *testing.T) {
assert.False(t, cmap.Has("key2"))
assert.Nil(t, cmap.Get("key2"))
}
func BenchmarkCMapHas(b *testing.B) {
m := NewCMap()
for i := 0; i < 1000; i++ {
m.Set(string(i), i)
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
m.Has(string(i))
}
}