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

Function BenchmarkSerializationSparse

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

Source from the content-addressed store, hash-verified

803}
804
805func BenchmarkSerializationSparse(b *testing.B) {
806 b.ReportAllocs()
807 b.StopTimer()
808 r := rand.New(rand.NewSource(0))
809 s := NewBitmap()
810 sz := 100000000
811 initsize := 65000
812 for i := 0; i < initsize; i++ {
813 s.Add(uint32(r.Int31n(int32(sz))))
814 }
815 buf := make([]byte, 0, s.GetSerializedSizeInBytes())
816 b.StartTimer()
817
818 for j := 0; j < b.N; j++ {
819 w := bytes.NewBuffer(buf[:0])
820 s.WriteTo(w)
821 }
822}
823
824func BenchmarkSerializationMid(b *testing.B) {
825 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…