prometheus/model/labels
Bryan Boreham e1115ae58d
labels: improve Get method for stringlabels build (#12485)
Inline one call to `decodeString`, and skip decoding the value string
until we find a match for the name.
Do a quick check on the first character in each string,
and exit early if we've gone past - labels are sorted in order.

Also improve tests and benchmark:
* labels: test Get with varying lengths - it's not typical for Prometheus labels to all be the same length.
* extend benchmark with label not found

---------

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-06-26 18:35:22 +01:00
..
labels.go Merge pull request #12366 from prometheus/release-2.44 2023-05-16 18:06:29 +01:00
labels_stringlabels.go labels: improve Get method for stringlabels build (#12485) 2023-06-26 18:35:22 +01:00
labels_test.go labels: improve Get method for stringlabels build (#12485) 2023-06-26 18:35:22 +01:00
matcher.go Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
matcher_test.go feat: dont compile regex matcher if we know its a literal (#12434) 2023-06-07 21:54:30 +01:00
regexp.go feat: dont compile regex matcher if we know its a literal (#12434) 2023-06-07 21:54:30 +01:00
regexp_test.go Allow downstream projects to use faster regexp (#10251) 2022-02-08 11:03:20 +01:00
test_utils.go labels: use ScratchBuilder in ReadLabels 2022-12-19 15:22:09 +00:00