(b *testing.B)
| 1068 | } |
| 1069 | |
| 1070 | func BenchmarkParallelCacheGetWithBuf(b *testing.B) { |
| 1071 | b.ReportAllocs() |
| 1072 | b.StopTimer() |
| 1073 | cache := NewCache(256 * 1024 * 1024) |
| 1074 | var key [8]byte |
| 1075 | buf := make([]byte, 64) |
| 1076 | for i := 0; i < b.N; i++ { |
| 1077 | binary.LittleEndian.PutUint64(key[:], uint64(i)) |
| 1078 | cache.Set(key[:], buf, 0) |
| 1079 | } |
| 1080 | b.StartTimer() |
| 1081 | |
| 1082 | b.RunParallel(func(pb *testing.PB) { |
| 1083 | counter := 0 |
| 1084 | b.ReportAllocs() |
| 1085 | for pb.Next() { |
| 1086 | binary.LittleEndian.PutUint64(key[:], uint64(counter)) |
| 1087 | cache.GetWithBuf(key[:], buf) |
| 1088 | counter = counter + 1 |
| 1089 | } |
| 1090 | }) |
| 1091 | } |
| 1092 | |
| 1093 | func BenchmarkCacheGetWithExpiration(b *testing.B) { |
| 1094 | b.StopTimer() |
nothing calls this directly
no test coverage detected
searching dependent graphs…