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

Function Benchmark_freelist_hashmapGetFreePageIDs

internal/freelist/hashmap_test.go:188–207  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

186}
187
188func Benchmark_freelist_hashmapGetFreePageIDs(b *testing.B) {
189 f := newTestHashMapFreelist()
190 N := int32(100000)
191 fm := make(map[common.Pgid]uint64)
192 i := int32(0)
193 val := int32(0)
194 for i = 0; i < N; {
195 val = rand.Int31n(1000)
196 fm[common.Pgid(i)] = uint64(val)
197 i += val
198 }
199
200 f.forwardMap = fm
201
202 b.ReportAllocs()
203 b.ResetTimer()
204 for n := 0; n < b.N; n++ {
205 f.freePageIds()
206 }
207}
208
209func Benchmark_freelist_hashmapMergeSpans(b *testing.B) {
210 type testCase struct {

Callers

nothing calls this directly

Calls 3

PgidTypeAlias · 0.92
newTestHashMapFreelistFunction · 0.85
freePageIdsMethod · 0.65

Tested by

no test coverage detected