MCPcopy
hub / github.com/lindb/lindb / BenchmarkEngine_DatabaseWithLockFreeSlice

Function BenchmarkEngine_DatabaseWithLockFreeSlice

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

Source from the content-addressed store, hash-verified

507}
508
509func BenchmarkEngine_DatabaseWithLockFreeSlice(b *testing.B) {
510 type entry struct {
511 db *database
512 name string
513 }
514 var v atomic.Value
515 var entries []entry
516 for _, dn := range testDatabaseNames {
517 entries = append(entries, entry{name: dn, db: &database{}})
518 }
519 v.Store(entries)
520 // 2.534 ns
521 b.RunParallel(func(pb *testing.PB) {
522 for pb.Next() {
523 sl := v.Load().([]entry)
524 for idx := range sl {
525 if sl[idx].name == "nginx" {
526 break
527 }
528 }
529 }
530 })
531}

Callers

nothing calls this directly

Calls 2

NextMethod · 0.65
LoadMethod · 0.65

Tested by

no test coverage detected