Skip to content

Conversation

@jeschkies
Copy link
Contributor

What this PR does / why we need it:
Backport of #18637

**What this PR does / why we need it**:
The JSON and logfmt parsers suffer from a high number of allocations when the parsed labels have a high cardinality.

This change reduces the allocations quite a bit by copying the labels bytes to a byte buffer.

Note: The benchmarks ran without a validation step that calls `LabelResult.Labels()` as that method uses a lot of allocation but is used only once in production code.
@jeschkies jeschkies requested a review from a team as a code owner September 1, 2025 09:54
@jeschkies jeschkies requested a review from chaudum September 1, 2025 09:54
@chaudum chaudum merged commit cc330e2 into grafana:k270 Sep 1, 2025
70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants