MCPcopy
hub / github.com/etcd-io/bbolt / benchmark_FreelistRelease

Function benchmark_FreelistRelease

internal/freelist/freelist_test.go:573–584  ·  view source on GitHub ↗
(b *testing.B, size int)

Source from the content-addressed store, hash-verified

571func Benchmark_FreelistRelease10000K(b *testing.B) { benchmark_FreelistRelease(b, 10000000) }
572
573func benchmark_FreelistRelease(b *testing.B, size int) {
574 ids := randomPgids(size)
575 pending := randomPgids(len(ids) / 400)
576 b.ResetTimer()
577 for i := 0; i < b.N; i++ {
578 txp := &txPending{ids: pending}
579 f := newTestFreelist()
580 f.pendingPageIds()[1] = txp
581 f.Init(ids)
582 f.release(1)
583 }
584}
585
586func randomPgids(n int) []common.Pgid {
587 pgids := make(common.Pgids, n)

Calls 5

randomPgidsFunction · 0.85
newTestFreelistFunction · 0.85
pendingPageIdsMethod · 0.65
InitMethod · 0.65
releaseMethod · 0.65

Tested by

no test coverage detected