Skip to content

Commit 503c9e9

Browse files
committed
save
1 parent 65d7bf6 commit 503c9e9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

db/recsplit/eliasfano32/elias_fano_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package eliasfano32
1818

1919
import (
2020
"bytes"
21+
"fmt"
2122
"math"
2223
"math/bits"
2324
"testing"
@@ -590,6 +591,22 @@ func BenchmarkEF(b *testing.B) {
590591
})
591592
}
592593

594+
func BenchmarkBuild(b *testing.B) {
595+
for _, count := range []uint64{100, 1_000_000} {
596+
b.Run(fmt.Sprintf("count=%d", count), func(b *testing.B) {
597+
maxOffset := (count - 1) * 123
598+
ef := NewEliasFano(count, maxOffset)
599+
for i := uint64(0); i < count; i++ {
600+
ef.AddOffset(i * 123)
601+
}
602+
b.ResetTimer()
603+
for b.Loop() {
604+
ef.Build()
605+
}
606+
})
607+
}
608+
}
609+
593610
func naiveReverseIterator(ef *EliasFano) *stream.ArrStream[uint64] {
594611
it := ef.Iterator()
595612
var values []uint64

0 commit comments

Comments
 (0)