Add IncrementInt benchmark

This commit is contained in:
Patrick Mylund Nielsen 2015-11-28 14:56:23 -05:00
parent 901b2413ee
commit cf4e165754
1 changed files with 10 additions and 0 deletions

View File

@ -1592,6 +1592,16 @@ func BenchmarkRWMutexMapSetDeleteSingleLock(b *testing.B) {
} }
} }
func BenchmarkIncrementInt(b *testing.B) {
b.StopTimer()
tc := New(DefaultExpiration, 0)
tc.Set("foo", 0, DefaultExpiration)
b.StartTimer()
for i := 0; i < b.N; i++ {
tc.IncrementInt("foo", 1)
}
}
func BenchmarkDeleteExpired(b *testing.B) { func BenchmarkDeleteExpired(b *testing.B) {
b.StopTimer() b.StopTimer()
tc := New(1, 0) tc := New(1, 0)