Update benchmark test and comment

This commit is contained in:
Carrie Edwards 2024-12-27 09:09:13 -08:00
parent df88de5800
commit 1508149184
2 changed files with 3 additions and 2 deletions

View File

@ -770,7 +770,7 @@ func (e *Encoder) HistogramSamples(histograms []RefHistogramSample, b []byte) ([
EncodeHistogram(&buf, h.H)
}
// Reset buffer if only custom bucket histograms existed in list of histogram samples
// Reset buffer if only custom bucket histograms existed in list of histogram samples.
if len(histograms) == len(customBucketHistograms) {
buf.Reset()
}

View File

@ -585,7 +585,7 @@ func BenchmarkWAL_HistogramEncoding(b *testing.B) {
for _, labelCount := range []int{0, 10, 50} {
for _, histograms := range []int{10, 100, 1000} {
for _, buckets := range []int{0, 1, 10, 100} {
b.Run(fmt.Sprintf("%s labels=%d histograms=%d buckets=%d", maker.name, labelCount, histograms, buckets), func(b *testing.B) {
b.Run(fmt.Sprintf("type=%s/labels=%d/histograms=%d/buckets=%d", maker.name, labelCount, histograms, buckets), func(b *testing.B) {
resetCache()
maker.init(labelCount, histograms, buckets)
enc := Encoder{}
@ -598,6 +598,7 @@ func BenchmarkWAL_HistogramEncoding(b *testing.B) {
if len(leftOver) > 0 {
enc.CustomBucketsHistogramSamples(leftOver, buf)
}
b.ReportMetric(float64(len(buf)), "recordBytes/ops")
}
})
}