mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 22:44:24 +00:00
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:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user