prometheus/model
Bryan Boreham 6136ae67e0 labels: shrink by making internals a single string
This commit adds an alternate implementation for `labels.Labels`, behind
a build tag `stringlabels`.

Instead of storing label names and values as individual strings, they
are all concatenated into one string in this format:

    [len][name0][len][value0][len][name1][len][value1]...

The lengths are varint encoded so usually a single byte.

The previous `[]string` had 24 bytes of overhead for the slice and 16
for each label name and value; this one has 16 bytes overhead plus 1
for each name and value.

In `ScratchBuilder.Overwrite` and `Labels.Hash` we use an unsafe
conversion from string to byte slice. `Overwrite` is explicitly unsafe,
but for `Hash` this is a pure performance hack.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-02-22 15:34:23 +00:00
..
exemplar Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
histogram tsdb: Add counter reset hint to histograms and support in WAL 2023-01-10 17:41:53 +05:30
labels labels: shrink by making internals a single string 2023-02-22 15:34:23 +00:00
metadata Introduce TSDB changes for appending metadata to the WAL (#10972) 2022-07-19 10:58:52 +02:00
relabel Update package model/relabel tests for new labels.Labels type 2022-12-19 15:22:09 +00:00
rulefmt Add rulefmt tests 2023-01-19 10:44:35 +01:00
textparse textparse: Minor doc comment improvement 2023-01-11 00:30:55 +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