bigcache-bench
bigcache-bench copied to clipboard
Not sure what is wrong but it a bit slow.
BenchmarkLRUByteHashSet-12 53083549 22.0 ns/op 5 B/op 0 allocs/op
BenchmarkLRUSet-12 12577149 96.6 ns/op 106 B/op 3 allocs/op
BenchmarkBigCacheSet-12 9351686 126 ns/op 71 B/op 0 allocs/op
BenchmarkLRUByteHashGet-12 107372199 11.0 ns/op 2 B/op 0 allocs/op
BenchmarkLRUGet-12 59989704 20.1 ns/op 5 B/op 0 allocs/op
BenchmarkBigCacheGet-12 18905139 63.2 ns/op 2 B/op 2 allocs/op
func BenchmarkBigCacheGet(b *testing.B) {
cache, _ := bigcache.NewBigCache(bigcache.Config{
Shards: 256,
LifeWindow: 10 * time.Minute,
MaxEntrySize: 256,
Verbose: false,
})
cache.Set("1", []byte("1"))
for n := 0; n < b.N; n++ {
cache.Get("1")
}
}
func BenchmarkBigCacheSet(b *testing.B) {
cache, _ := bigcache.NewBigCache(bigcache.Config{
Shards: 256,
LifeWindow: 10 * time.Minute,
MaxEntrySize: 256,
Verbose: false,
})
for n := 0; n < b.N; n++ {
cache.Set("1", []byte("1"))
}
}