prometheus/tsdb/chunkenc
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
..
bstream_test.go
bstream.go enable gocritic, unconvert and unused linters 2023-04-13 19:20:22 +00:00
chunk_test.go tsdb: use Go standard errors 2023-12-11 12:18:54 +00:00
chunk.go Optimize histogram iterators (#13340) 2024-01-23 17:02:14 +01:00
float_histogram_test.go Optimize histogram iterators (#13340) 2024-01-23 17:02:14 +01:00
float_histogram.go Optimize histogram iterators (#13340) 2024-01-23 17:02:14 +01:00
histogram_meta_test.go histograms: General readability tweaks 2023-01-19 13:26:42 +01:00
histogram_meta.go ci(lint): enable godot; append dot at the end of comments 2023-10-31 19:53:38 +02:00
histogram_test.go Optimize histogram iterators (#13340) 2024-01-23 17:02:14 +01:00
histogram.go Optimize histogram iterators (#13340) 2024-01-23 17:02:14 +01:00
varbit_test.go Use more varbit in histogram chunks 2021-10-13 20:03:35 +02:00
varbit.go tsdb/chunkenc: use Go standard errors package 2023-11-08 08:38:57 +00:00
xor_test.go chunkenc: Slightly optimize xorWrite/xoRead (#11476) 2022-10-20 15:08:01 +05:30
xor.go Optimize histogram iterators (#13340) 2024-01-23 17:02:14 +01:00