Skip to content

Combine and extend Prometheus text and OpenMetrics 1.0 encoder benchmarks#943

Merged
bwplotka merged 1 commit into
prometheus:mainfrom
dashpole:expfmt-benchmark
Jul 8, 2026
Merged

Combine and extend Prometheus text and OpenMetrics 1.0 encoder benchmarks#943
bwplotka merged 1 commit into
prometheus:mainfrom
dashpole:expfmt-benchmark

Conversation

@dashpole

@dashpole dashpole commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Split from #894. Part of #893.

Consolidate BenchmarkOpenMetricsCreate and BenchmarkCreate into a single benchmark, and expand the types that are benchmarked. This is in preparation to add OpenMetrics 2.0 support.

goos: linux
goarch: amd64
pkg: github.com/prometheus/common/expfmt
cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
                                             │ /tmp/bench.txt │
                                             │     sec/op     │
ConvertMetricFamily/TEXT/COUNTER-24               775.5n ± 1%
ConvertMetricFamily/OM1.0/COUNTER-24              1.664µ ± 1%
ConvertMetricFamily/TEXT/GAUGE-24                 761.5n ± 1%
ConvertMetricFamily/OM1.0/GAUGE-24                1.091µ ± 6%
ConvertMetricFamily/TEXT/UNTYPED-24               680.6n ± 1%
ConvertMetricFamily/OM1.0/UNTYPED-24              923.8n ± 3%
ConvertMetricFamily/TEXT/SUMMARY-24               3.207µ ± 1%
ConvertMetricFamily/OM1.0/SUMMARY-24              3.965µ ± 1%
ConvertMetricFamily/TEXT/HISTOGRAM-24             4.532µ ± 2%
ConvertMetricFamily/OM1.0/HISTOGRAM-24            5.582µ ± 2%
ConvertMetricFamily/TEXT/GAUGE_HISTOGRAM-24       3.414µ ± 1%
ConvertMetricFamily/OM1.0/GAUGE_HISTOGRAM-24      3.852µ ± 1%

                                             │ /tmp/bench.txt │
                                             │      B/op      │
ConvertMetricFamily/TEXT/COUNTER-24              0.000 ± 0%
ConvertMetricFamily/OM1.0/COUNTER-24             33.00 ± 0%
ConvertMetricFamily/TEXT/GAUGE-24                0.000 ± 0%
ConvertMetricFamily/OM1.0/GAUGE-24               1.000 ± 0%
ConvertMetricFamily/TEXT/UNTYPED-24              0.000 ± 0%
ConvertMetricFamily/OM1.0/UNTYPED-24             1.000 ± 0%
ConvertMetricFamily/TEXT/SUMMARY-24              56.00 ± 0%
ConvertMetricFamily/OM1.0/SUMMARY-24             57.00 ± 0%
ConvertMetricFamily/TEXT/HISTOGRAM-24            288.0 ± 0%
ConvertMetricFamily/OM1.0/HISTOGRAM-24           289.0 ± 0%
ConvertMetricFamily/TEXT/GAUGE_HISTOGRAM-24      160.0 ± 0%
ConvertMetricFamily/OM1.0/GAUGE_HISTOGRAM-24     161.0 ± 0%

                                             │ /tmp/bench.txt │
                                             │   allocs/op    │
ConvertMetricFamily/TEXT/COUNTER-24              0.000 ± 0%
ConvertMetricFamily/OM1.0/COUNTER-24             2.000 ± 0%
ConvertMetricFamily/TEXT/GAUGE-24                0.000 ± 0%
ConvertMetricFamily/OM1.0/GAUGE-24               1.000 ± 0%
ConvertMetricFamily/TEXT/UNTYPED-24              0.000 ± 0%
ConvertMetricFamily/OM1.0/UNTYPED-24             1.000 ± 0%
ConvertMetricFamily/TEXT/SUMMARY-24              2.000 ± 0%
ConvertMetricFamily/OM1.0/SUMMARY-24             3.000 ± 0%
ConvertMetricFamily/TEXT/HISTOGRAM-24            6.000 ± 0%
ConvertMetricFamily/OM1.0/HISTOGRAM-24           7.000 ± 0%
ConvertMetricFamily/TEXT/GAUGE_HISTOGRAM-24      5.000 ± 0%
ConvertMetricFamily/OM1.0/GAUGE_HISTOGRAM-24     6.000 ± 0%

@bwplotka bwplotka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One nit, otherwise LGTM

Comment thread expfmt/benchmark_test.go Outdated
…trics 1.0 encoders

Signed-off-by: David Ashpole <dashpole@google.com>
@dashpole dashpole force-pushed the expfmt-benchmark branch from 660663a to 9d0c43b Compare July 8, 2026 13:43
@bwplotka bwplotka merged commit 97c066a into prometheus:main Jul 8, 2026
8 checks passed
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.

2 participants