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

Function BenchmarkSerializationDense

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

Source from the content-addressed store, hash-verified

841}
842
843func BenchmarkSerializationDense(b *testing.B) {
844 b.ReportAllocs()
845 b.StopTimer()
846 r := rand.New(rand.NewSource(0))
847 s := NewBitmap()
848 sz := 150000
849 initsize := 65000
850 for i := 0; i < initsize; i++ {
851 s.Add(uint32(r.Int31n(int32(sz))))
852 }
853 buf := make([]byte, 0, s.GetSerializedSizeInBytes())
854 b.StartTimer()
855
856 for j := 0; j < b.N; j++ {
857 w := bytes.NewBuffer(buf[:0])
858 s.WriteTo(w)
859 }
860}
861
862func BenchmarkMarshalBinary(b *testing.B) {
863 r := rand.New(rand.NewSource(0))

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…