MCPcopy
hub / github.com/lindb/lindb / Benchmark_LoadSyncMap

Function Benchmark_LoadSyncMap

tsdb/database_test.go:541–555  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

539}
540
541func Benchmark_LoadSyncMap(b *testing.B) {
542 var m sync.Map
543 for i := 0; i < boundaryShardSetLen; i++ {
544 m.Store(i, &shard{})
545 }
546 // 8.435 ns
547 b.RunParallel(func(pb *testing.PB) {
548 for pb.Next() {
549 item, ok := m.Load(boundaryShardSetLen - 1)
550 if ok {
551 _, _ = item.(*shard)
552 }
553 }
554 })
555}
556
557func Benchmark_LoadAtomicValue(b *testing.B) {
558 var v atomic.Value

Callers

nothing calls this directly

Calls 2

NextMethod · 0.65
LoadMethod · 0.65

Tested by

no test coverage detected