mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
lib/promscrape: add a benchmark for internLabelStrings()
This commit is contained in:
parent
b0b8f05fa4
commit
047fe3ee67
1 changed files with 31 additions and 0 deletions
31
lib/promscrape/config_timing_test.go
Normal file
31
lib/promscrape/config_timing_test.go
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
package promscrape
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal"
|
||||||
|
)
|
||||||
|
|
||||||
|
func BenchmarkInternLabelStrings(b *testing.B) {
|
||||||
|
b.ReportAllocs()
|
||||||
|
b.SetBytes(1)
|
||||||
|
b.RunParallel(func(pb *testing.PB) {
|
||||||
|
labels := []prompbmarshal.Label{
|
||||||
|
{
|
||||||
|
Name: "job",
|
||||||
|
Value: "node-exporter",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "instance",
|
||||||
|
Value: "foo.bar.baz:1234",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "__meta_kubernetes_namespace",
|
||||||
|
Value: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for pb.Next() {
|
||||||
|
internLabelStrings(labels)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in a new issue