Skip to content

Commit

Permalink
feature: introduces FillUp method
Browse files Browse the repository at this point in the history
  • Loading branch information
aliszka committed Dec 16, 2024
1 parent 2e6fef9 commit a00d2da
Show file tree
Hide file tree
Showing 4 changed files with 1,370 additions and 59 deletions.
38 changes: 38 additions & 0 deletions benchmark_opt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,44 @@ func BenchmarkPrefillFromSortedList(b *testing.B) {
}
}

// go test -v -bench BenchmarkFillUpNative -benchmem -run ^$ github.com/weaviate/sroar -cpuprofile cpu.prof
func BenchmarkFillUpNative(b *testing.B) {
for i := 0; i < b.N; i++ {
bm := Prefill(100_000_000)
bm.FillUp(150_000_000)
bm.FillUp(200_000_000)
}
}

// go test -v -bench BenchmarkPrefillFromSortedList -benchmem -run ^$ github.com/weaviate/sroar -cpuprofile cpu.prof
func BenchmarkFillUpFromSortedList(b *testing.B) {
prefillBufferSize := 65_536
prefillX := uint64(100_000_000)
fillupX1 := uint64(150_000_000)
fillupX2 := uint64(200_000_000)
inc := uint64(prefillBufferSize)
buf := make([]uint64, prefillBufferSize)

for i := 0; i < b.N; i++ {
bm := Prefill(prefillX)

for i := prefillX + 1; i <= fillupX1; i += inc {
j := uint64(0)
for ; j < inc && i+j <= fillupX1; j++ {
buf[j] = i + j
}
bm.Or(FromSortedList(buf[:j]))
}
for i := fillupX1 + 1; i <= fillupX2; i += inc {
j := uint64(0)
for ; j < inc && i+j <= fillupX2; j++ {
buf[j] = i + j
}
bm.Or(FromSortedList(buf[:j]))
}
}
}

// ================================================================================
//
// BENCHMARKS comparing performance of different merge implementations
Expand Down
Loading

0 comments on commit a00d2da

Please sign in to comment.