MCPcopy
hub / github.com/lindb/lindb / BenchmarkEngine_DatabaseWithLockFreeMap

Function BenchmarkEngine_DatabaseWithLockFreeMap

tsdb/engine_test.go:493–507  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

491}
492
493func BenchmarkEngine_DatabaseWithLockFreeMap(b *testing.B) {
494 var v atomic.Value
495 lm := make(map[string]*database)
496 for _, dn := range testDatabaseNames {
497 lm[dn] = &database{}
498 }
499 v.Store(lm)
500 // 3.895 ns
501 b.RunParallel(func(pb *testing.PB) {
502 for pb.Next() {
503 thisMap := v.Load().(map[string]*database)
504 _ = thisMap["application"]
505 }
506 })
507}
508
509func BenchmarkEngine_DatabaseWithLockFreeSlice(b *testing.B) {
510 type entry struct {

Callers

nothing calls this directly

Calls 2

NextMethod · 0.65
LoadMethod · 0.65

Tested by

no test coverage detected