mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
fix two benchmarks (#631)
* fix two benchmarks Signed-off-by: naivewong <867245430@qq.com>
This commit is contained in:
parent
cb4a085709
commit
b05ca5c36e
|
@ -800,11 +800,11 @@ func BenchmarkCompaction(b *testing.B) {
|
|||
compactionType: "normal",
|
||||
},
|
||||
{
|
||||
ranges: [][2]int64{{0, 10000}, {20000, 30000}, {40000, 50000}, {60000, 70000}},
|
||||
ranges: [][2]int64{{0, 2000}, {3000, 5000}, {6000, 8000}, {9000, 11000}},
|
||||
compactionType: "normal",
|
||||
},
|
||||
{
|
||||
ranges: [][2]int64{{0, 100000}, {200000, 300000}, {400000, 500000}, {600000, 700000}},
|
||||
ranges: [][2]int64{{0, 5000}, {6000, 11000}, {12000, 17000}, {18000, 23000}},
|
||||
compactionType: "normal",
|
||||
},
|
||||
// 40% overlaps.
|
||||
|
@ -817,11 +817,11 @@ func BenchmarkCompaction(b *testing.B) {
|
|||
compactionType: "vertical",
|
||||
},
|
||||
{
|
||||
ranges: [][2]int64{{0, 10000}, {6000, 16000}, {12000, 22000}, {18000, 28000}},
|
||||
ranges: [][2]int64{{0, 2000}, {1200, 3200}, {2400, 4400}, {3600, 5600}},
|
||||
compactionType: "vertical",
|
||||
},
|
||||
{
|
||||
ranges: [][2]int64{{0, 100000}, {60000, 160000}, {120000, 220000}, {180000, 280000}},
|
||||
ranges: [][2]int64{{0, 5000}, {3000, 8000}, {6000, 11000}, {9000, 14000}},
|
||||
compactionType: "vertical",
|
||||
},
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import (
|
|||
"math/rand"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
|
@ -34,8 +33,7 @@ import (
|
|||
)
|
||||
|
||||
func BenchmarkCreateSeries(b *testing.B) {
|
||||
lbls, err := labels.ReadLabels(filepath.Join("testdata", "20kseries.json"), b.N)
|
||||
testutil.Ok(b, err)
|
||||
series := genSeries(b.N, 10, 0, 0)
|
||||
|
||||
h, err := NewHead(nil, nil, nil, 10000)
|
||||
testutil.Ok(b, err)
|
||||
|
@ -44,8 +42,8 @@ func BenchmarkCreateSeries(b *testing.B) {
|
|||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
for _, l := range lbls {
|
||||
h.getOrCreate(l.Hash(), l)
|
||||
for _, s := range series {
|
||||
h.getOrCreate(s.Labels().Hash(), s.Labels())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue