Skip to content

Conversation

@csmarchbanks
Copy link
Member

@csmarchbanks csmarchbanks commented Jul 2, 2025

Several commits that help alleviate the CPU increase reported in #1114. The performance is still worse than 0.22.1 but moving in the correct direction, and I don't know if we will be able to match performance with the additional features.

For reference, here are the benchmark results from my laptop. We still have a ways to go to get back to original peformance.

----------------------------------------------------------------------------------------------------------- benchmark: 3 tests ----------------------------------------------------------------------------------------------------------
Name (time in us)                                                     Min                 Max                Mean            StdDev              Median               IQR            Outliers  OPS (Kops/s)            Rounds  Iterations
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_text_string_to_metric_families (0001_v0.21.1)      60.3750 (1.0)       90.5000 (1.0)       63.5184 (1.0)      2.5867 (1.0)       62.9170 (1.0)      0.5410 (1.0)      706;1090       15.7435 (1.0)        6499           1
test_benchmark_text_string_to_metric_families (0008_optimiz)     197.5420 (3.27)     295.6670 (3.27)     205.3111 (3.23)     5.4140 (2.09)     203.6250 (3.24)     2.0841 (3.85)      230;293        4.8707 (0.31)       2543           1
test_benchmark_text_string_to_metric_families (0011_v0.22.1)     296.1660 (4.91)     412.5830 (4.56)     307.6600 (4.84)     7.9195 (3.06)     305.2080 (4.85)     3.4160 (6.31)      202;225        3.2503 (0.21)       1614           1
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

@csmarchbanks csmarchbanks changed the base branch from master to parser-benchmark July 3, 2025 14:31
This saves ~10% in the benchmark.

Signed-off-by: Chris Marchbanks <[email protected]>
Enumerating rather than using a while loop saves significant CPU when
looking for an unquoted character. This ends up improving the benchmark
~20% on its own.

Signed-off-by: Chris Marchbanks <[email protected]>
Split the term into the label name and label value portions in one swoop
rather than starting from the beginning to find an = character after
already going through the full term. This saves ~5% on the benchmark.

Signed-off-by: Chris Marchbanks <[email protected]>
Copy link
Member

@ywwg ywwg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for working on this <3

Base automatically changed from parser-benchmark to master July 8, 2025 15:56
@csmarchbanks csmarchbanks merged commit 26da805 into master Jul 8, 2025
11 checks passed
@csmarchbanks csmarchbanks deleted the optimize-parser branch July 8, 2025 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants