prometheus/model
Filip Petkovski 583f3e587c
Optimize histogram iterators (#13340)
Optimize histogram iterators

Histogram iterators allocate new objects in the AtHistogram and
AtFloatHistogram methods, which makes calculating rates over long
ranges expensive.

In #13215 we allowed an existing object to be reused
when converting an integer histogram to a float histogram. This commit follows
the same idea and allows injecting an existing object in the AtHistogram and
AtFloatHistogram methods. When the injected value is nil, iterators allocate
new histograms, otherwise they populate and return the injected object.

The commit also adds a CopyTo method to Histogram and FloatHistogram which
is used in the BufferedIterator to overwrite items in the ring instead of making
new copies.

Note that a specialized HPoint pool is needed for all of this to work 
(`matrixSelectorHPool`).

---------

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
2024-01-23 17:02:14 +01:00
..
exemplar Scraping: use slices.sort for exemplars 2023-11-24 14:42:26 +00:00
histogram Optimize histogram iterators (#13340) 2024-01-23 17:02:14 +01:00
labels labels: extract common code between slice and stringlabels 2023-11-17 18:20:03 +00:00
metadata Move metric type definitions to common/model 2023-12-19 18:56:54 +00:00
relabel relabel: blank replacement deletes label post-regexp 2023-12-18 16:39:01 +00:00
rulefmt golangci-lint: enable testifylint linter (#13254) 2023-12-07 11:35:01 +00:00
textparse Merge pull request #13299 from vesari/add-unit-parser 2024-01-09 14:47:50 +01:00
timestamp Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
value Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00