mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-10 15:01:03 +00:00
roaring: improve SliceAscending/SliceDescending tests
Two changes: First, make SliceDescending set the entire slice, not all-but-one bits. Second, add tests that are "striped", so it's writing to 8 parts of the slice sequentially, rather than just going up or down the whole thing, because that gives us some cheap indication of cache-locality impact, which turns out to be possibly significant.
This commit is contained in:
parent
d5b4197793
commit
67e3dc4a08
1 changed files with 35 additions and 0 deletions
|
|
@ -1348,5 +1348,40 @@ func BenchmarkSliceDescending(b *testing.B) {
|
|||
for col := uint64(pilosa.ShardWidth); col > uint64(0); col-- {
|
||||
bm.Add(col)
|
||||
}
|
||||
bm.Add(0)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkSliceAscendingStriped(b *testing.B) {
|
||||
for n := 0; n < b.N; n++ {
|
||||
bm := roaring.NewFileBitmap()
|
||||
l := uint64(pilosa.ShardWidth / 8)
|
||||
for col := uint64(0); col < l; col++ {
|
||||
bm.Add(l*0 + col)
|
||||
bm.Add(l*1 + col)
|
||||
bm.Add(l*2 + col)
|
||||
bm.Add(l*3 + col)
|
||||
bm.Add(l*4 + col)
|
||||
bm.Add(l*5 + col)
|
||||
bm.Add(l*6 + col)
|
||||
bm.Add(l*7 + col)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkSliceDescendingStriped(b *testing.B) {
|
||||
for n := 0; n < b.N; n++ {
|
||||
bm := roaring.NewFileBitmap()
|
||||
l := uint64(pilosa.ShardWidth / 8)
|
||||
for col := uint64(l); col < l+1; col-- {
|
||||
bm.Add(l*7 + col)
|
||||
bm.Add(l*6 + col)
|
||||
bm.Add(l*5 + col)
|
||||
bm.Add(l*4 + col)
|
||||
bm.Add(l*3 + col)
|
||||
bm.Add(l*2 + col)
|
||||
bm.Add(l*1 + col)
|
||||
bm.Add(l*0 + col)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue