mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vmselect/netstorage: add mergeSortBlocks benchmark for the worstcase
This commit is contained in:
parent
076799ae29
commit
8429d4af5a
1 changed files with 28 additions and 1 deletions
|
@ -27,7 +27,7 @@ func BenchmarkMergeSortBlocks(b *testing.B) {
|
|||
benchmarkMergeSortBlocks(b, blocks)
|
||||
})
|
||||
}
|
||||
b.Run("overlapped-blocks", func(b *testing.B) {
|
||||
b.Run("overlapped-blocks-bestcase", func(b *testing.B) {
|
||||
const samplesPerBlock = 8192
|
||||
var blocks []*sortBlock
|
||||
for j := 0; j < 10; j++ {
|
||||
|
@ -51,6 +51,33 @@ func BenchmarkMergeSortBlocks(b *testing.B) {
|
|||
}
|
||||
benchmarkMergeSortBlocks(b, blocks)
|
||||
})
|
||||
b.Run("overlapped-blocks-worstcase", func(b *testing.B) {
|
||||
const samplesPerBlock = 8192
|
||||
var blocks []*sortBlock
|
||||
for j := 0; j < 5; j++ {
|
||||
timestamps := make([]int64, samplesPerBlock)
|
||||
values := make([]float64, samplesPerBlock)
|
||||
for i := range timestamps {
|
||||
timestamps[i] = int64(2 * (j*samplesPerBlock + i))
|
||||
values[i] = float64(2 * (j*samplesPerBlock + i))
|
||||
}
|
||||
blocks = append(blocks, &sortBlock{
|
||||
Timestamps: timestamps,
|
||||
Values: values,
|
||||
})
|
||||
timestamps = make([]int64, samplesPerBlock)
|
||||
values = make([]float64, samplesPerBlock)
|
||||
for i := range timestamps {
|
||||
timestamps[i] = int64(2*(j*samplesPerBlock+i) + 1)
|
||||
values[i] = float64(2*(j*samplesPerBlock+i) + 1)
|
||||
}
|
||||
blocks = append(blocks, &sortBlock{
|
||||
Timestamps: timestamps,
|
||||
Values: values,
|
||||
})
|
||||
}
|
||||
benchmarkMergeSortBlocks(b, blocks)
|
||||
})
|
||||
}
|
||||
|
||||
func benchmarkMergeSortBlocks(b *testing.B, blocks []*sortBlock) {
|
||||
|
|
Loading…
Reference in a new issue