(b *testing.B)
| 966 | } |
| 967 | |
| 968 | func BenchmarkParallelCacheSet(b *testing.B) { |
| 969 | cache := NewCache(256 * 1024 * 1024) |
| 970 | var key [8]byte |
| 971 | |
| 972 | b.RunParallel(func(pb *testing.PB) { |
| 973 | counter := 0 |
| 974 | b.ReportAllocs() |
| 975 | |
| 976 | for pb.Next() { |
| 977 | binary.LittleEndian.PutUint64(key[:], uint64(counter)) |
| 978 | cache.Set(key[:], make([]byte, 8), 0) |
| 979 | counter = counter + 1 |
| 980 | } |
| 981 | }) |
| 982 | } |
| 983 | |
| 984 | func BenchmarkMapSet(b *testing.B) { |
| 985 | m := make(map[string][]byte) |