MCPcopy
hub / github.com/RoaringBitmap/roaring / BenchmarkSerializationMid

Function BenchmarkSerializationMid

benchmark_test.go:824–841  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

822}
823
824func BenchmarkSerializationMid(b *testing.B) {
825 b.ReportAllocs()
826 b.StopTimer()
827 r := rand.New(rand.NewSource(0))
828 s := NewBitmap()
829 sz := 10000000
830 initsize := 65000
831 for i := 0; i < initsize; i++ {
832 s.Add(uint32(r.Int31n(int32(sz))))
833 }
834 buf := make([]byte, 0, s.GetSerializedSizeInBytes())
835 b.StartTimer()
836
837 for j := 0; j < b.N; j++ {
838 w := bytes.NewBuffer(buf[:0])
839 s.WriteTo(w)
840 }
841}
842
843func BenchmarkSerializationDense(b *testing.B) {
844 b.ReportAllocs()

Callers

nothing calls this directly

Calls 4

AddMethod · 0.95
WriteToMethod · 0.95
NewBitmapFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…