MCPcopy
hub / github.com/coocood/freecache / BenchmarkParallelCacheSet

Function BenchmarkParallelCacheSet

cache_test.go:968–982  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

966}
967
968func 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
984func BenchmarkMapSet(b *testing.B) {
985 m := make(map[string][]byte)

Callers

nothing calls this directly

Calls 3

SetMethod · 0.95
NewCacheFunction · 0.85
NextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…