Prometheus: Reduce allocations parsing exemplars (#58959)
* Prometheus: Reduce allocations parsing exemplars This reduces allocations for parsing exemplars. name old time/op new time/op delta ExemplarJson-8 24.7ms ±15% 17.6ms ± 2% -28.72% (p=0.008 n=5+5) name old alloc/op new alloc/op delta ExemplarJson-8 4.70MB ± 0% 3.58MB ± 0% -23.79% (p=0.008 n=5+5) name old allocs/op new allocs/op delta ExemplarJson-8 72.6k ± 0% 69.1k ± 0% -4.81% (p=0.008 n=5+5) * Ensure pairs is reset
This commit is contained in:
@@ -37,6 +37,7 @@ func BenchmarkExemplarJson(b *testing.B) {
|
||||
tCtx, err := setup(true)
|
||||
require.NoError(b, err)
|
||||
b.ResetTimer()
|
||||
b.ReportAllocs()
|
||||
for n := 0; n < b.N; n++ {
|
||||
res := http.Response{
|
||||
StatusCode: 200,
|
||||
|
||||
Reference in New Issue
Block a user