mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
benchmarks: SetBytes takes bytes per operation
Where the code was multiplying bytes by number of operations, this resulted in absurdly high throughput numbers. Also, in `BenchmarkParse()`, don't run the `expfmt` case twice. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
c8786974d1
commit
8120af22e2
|
@ -367,7 +367,7 @@ func BenchmarkParse(b *testing.B) {
|
||||||
b.Run(parserName+"/no-decode-metric/"+fn, func(b *testing.B) {
|
b.Run(parserName+"/no-decode-metric/"+fn, func(b *testing.B) {
|
||||||
total := 0
|
total := 0
|
||||||
|
|
||||||
b.SetBytes(int64(len(buf) * (b.N / promtestdataSampleCount)))
|
b.SetBytes(int64(len(buf) / promtestdataSampleCount))
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ func BenchmarkParse(b *testing.B) {
|
||||||
b.Run(parserName+"/decode-metric/"+fn, func(b *testing.B) {
|
b.Run(parserName+"/decode-metric/"+fn, func(b *testing.B) {
|
||||||
total := 0
|
total := 0
|
||||||
|
|
||||||
b.SetBytes(int64(len(buf) * (b.N / promtestdataSampleCount)))
|
b.SetBytes(int64(len(buf) / promtestdataSampleCount))
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ func BenchmarkParse(b *testing.B) {
|
||||||
total := 0
|
total := 0
|
||||||
res := make(labels.Labels, 0, 5)
|
res := make(labels.Labels, 0, 5)
|
||||||
|
|
||||||
b.SetBytes(int64(len(buf) * (b.N / promtestdataSampleCount)))
|
b.SetBytes(int64(len(buf) / promtestdataSampleCount))
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
|
||||||
|
@ -458,7 +458,10 @@ func BenchmarkParse(b *testing.B) {
|
||||||
_ = total
|
_ = total
|
||||||
})
|
})
|
||||||
b.Run("expfmt-text/"+fn, func(b *testing.B) {
|
b.Run("expfmt-text/"+fn, func(b *testing.B) {
|
||||||
b.SetBytes(int64(len(buf) * (b.N / promtestdataSampleCount)))
|
if parserName != "prometheus" {
|
||||||
|
b.Skip()
|
||||||
|
}
|
||||||
|
b.SetBytes(int64(len(buf) / promtestdataSampleCount))
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
|
||||||
|
@ -507,7 +510,7 @@ func BenchmarkGzip(b *testing.B) {
|
||||||
k := b.N / promtestdataSampleCount
|
k := b.N / promtestdataSampleCount
|
||||||
|
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
b.SetBytes(int64(k) * int64(n))
|
b.SetBytes(int64(n) / promtestdataSampleCount)
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
|
||||||
total := 0
|
total := 0
|
||||||
|
|
|
@ -176,7 +176,7 @@ func BenchmarkBufferedSeriesIterator(b *testing.B) {
|
||||||
// Simulate a 5 minute rate.
|
// Simulate a 5 minute rate.
|
||||||
it := NewBufferIterator(newFakeSeriesIterator(int64(b.N), 30), 5*60)
|
it := NewBufferIterator(newFakeSeriesIterator(int64(b.N), 30), 5*60)
|
||||||
|
|
||||||
b.SetBytes(int64(b.N * 16))
|
b.SetBytes(16)
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ func BenchmarkMemoizedSeriesIterator(b *testing.B) {
|
||||||
// Simulate a 5 minute rate.
|
// Simulate a 5 minute rate.
|
||||||
it := NewMemoizedIterator(newFakeSeriesIterator(int64(b.N), 30), 5*60)
|
it := NewMemoizedIterator(newFakeSeriesIterator(int64(b.N), 30), 5*60)
|
||||||
|
|
||||||
b.SetBytes(int64(b.N * 16))
|
b.SetBytes(16)
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue