(b *testing.B)
| 803 | } |
| 804 | |
| 805 | func 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 | |
| 824 | func BenchmarkSerializationMid(b *testing.B) { |
| 825 | b.ReportAllocs() |
nothing calls this directly
no test coverage detected
searching dependent graphs…