MCPcopy Index your code
hub / github.com/nutsdb/nutsdb / BenchmarkIterator_ValidCheck

Function BenchmarkIterator_ValidCheck

iterator_bench_test.go:341–360  ·  view source on GitHub ↗

BenchmarkIterator_ValidCheck tests Valid() method overhead

(b *testing.B)

Source from the content-addressed store, hash-verified

339
340// BenchmarkIterator_ValidCheck tests Valid() method overhead
341func BenchmarkIterator_ValidCheck(b *testing.B) {
342 db, bucket := setupIteratorBenchmark(b, 1000)
343 defer func() { _ = db.Close() }()
344
345 b.ResetTimer()
346 b.ReportAllocs()
347
348 err := db.View(func(tx *Tx) error {
349 iterator := NewIterator(tx, bucket, IteratorOptions{Reverse: false})
350 defer iterator.Release()
351
352 for i := 0; i < b.N; i++ {
353 _ = iterator.Valid()
354 }
355 return nil
356 })
357 if err != nil {
358 b.Fatalf("View failed: %v", err)
359 }
360}
361
362// BenchmarkIterator_MultipleIterators tests overhead of multiple concurrent iterators
363func BenchmarkIterator_MultipleIterators(b *testing.B) {

Callers

nothing calls this directly

Calls 6

ReleaseMethod · 0.95
ValidMethod · 0.95
setupIteratorBenchmarkFunction · 0.85
NewIteratorFunction · 0.85
ViewMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected