You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
makes inefficient use of memory. The bin that used to be at h.priorTimesBinList[0] doesn't go away, but it stays in the memory chunk allocated for the h.priorTimesBiList slice. If h.maxBins = 100, the capacity of the memory chunk holding the slice will eventually be 200. As bins are added and removed from the slice, the usable portion of the bins slice of 100 will walk up the memory chunk. When the bins slice reaches the end of the memory chunk of 200, go's append will allocate a new memory chunk of 200 and copy the bin slice of 100 to the start of that new memory chunk, and the bins slice will begin walking up that new memory chunk. What this means is that go programs using this histogram library will be doing more memory allocations and holding onto more memory than necessary. Also when the bins slice is near the end of its memory chunk, all of those TDigest objects in bins that fell off the beginning of the slice may not get GCed until the memory chunk gets GCed. A circular buffer would be good to use here. The circular buffer would only need to be allocated one time. Moreover, when the circular buffer starts overwriting old bins, it may be possible to reuse those old TDigest objects rather than allocate new ones.
The text was updated successfully, but these errors were encountered:
This line here
wavefront-sdk-go/histogram/histogram.go
Line 266 in de63acd
The text was updated successfully, but these errors were encountered: