From 0b6055e29ec3305b48f3914f2611b7bc22ce4ea2 Mon Sep 17 00:00:00 2001 From: Vishal Raj Date: Thu, 2 Jan 2025 16:36:17 +0000 Subject: [PATCH] [chore][processor/deltatocumulative] Optimize exponential histogram merge --- .../deltatocumulativeprocessor/internal/data/expo/merge.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/processor/deltatocumulativeprocessor/internal/data/expo/merge.go b/processor/deltatocumulativeprocessor/internal/data/expo/merge.go index 150e29a65819..e4d136c317aa 100644 --- a/processor/deltatocumulativeprocessor/internal/data/expo/merge.go +++ b/processor/deltatocumulativeprocessor/internal/data/expo/merge.go @@ -26,10 +26,10 @@ func Merge(arel, brel Buckets) { size := up - lo counts := pcommon.NewUInt64Slice() - counts.Append(make([]uint64, size-counts.Len())...) + counts.EnsureCapacity(size) - for i := 0; i < counts.Len(); i++ { - counts.SetAt(i, a.Abs(lo+i)+b.Abs(lo+i)) + for i := 0; i < size; i++ { + counts.Append(a.Abs(lo+i) + b.Abs(lo+i)) } a.SetOffset(int32(lo))