prometheus/tsdb/chunks
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
..
chunk_write_queue.go Fix: getting rid of EncOOOXOR chunk encoding (#12111) 2023-03-16 15:53:47 +05:30
chunk_write_queue_test.go Fix: getting rid of EncOOOXOR chunk encoding (#12111) 2023-03-16 15:53:47 +05:30
chunks.go Optimize histogram iterators (#13340) 2024-01-23 17:02:14 +01:00
chunks_test.go Change ChunkReader.Chunk() to ChunkOrIterable() 2023-11-28 11:14:29 +01:00
head_chunks.go tsdb: use Go standard errors 2023-12-11 12:18:54 +00:00
head_chunks_other.go remove obsolete build tag 2024-01-17 22:26:32 +08:00
head_chunks_test.go golangci-lint: enable testifylint linter (#13254) 2023-12-07 11:35:01 +00:00
head_chunks_windows.go Format Go source files using 'gofumpt -w -s -extra' 2021-11-02 19:52:34 +01:00
queue.go Reduce chunk write queue memory usage 2 (#10874) 2022-06-29 17:51:27 +05:30
queue_test.go golangci-lint: enable testifylint linter (#13254) 2023-12-07 11:35:01 +00:00
samples.go Add a chunk size limit in bytes (#12054) 2023-08-24 15:21:17 +02:00