Add WithUnsafeAttributes to support no-copy dynamic metric API calls#8251
Open
dashpole wants to merge 4 commits intoopen-telemetry:mainfrom
Open
Add WithUnsafeAttributes to support no-copy dynamic metric API calls#8251dashpole wants to merge 4 commits intoopen-telemetry:mainfrom
dashpole wants to merge 4 commits intoopen-telemetry:mainfrom
Conversation
dashpole
commented
Apr 22, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8251 +/- ##
=====================================
Coverage 82.9% 82.9%
=====================================
Files 314 314
Lines 24985 25022 +37
=====================================
+ Hits 20730 20767 +37
Misses 3882 3882
Partials 373 373
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an experimental WithUnsafeAttributes measurement option (in go.opentelemetry.io/otel/metric/x) and wires the SDK metric recording paths to recognize and merge these raw key-values into the effective attribute.Set used for aggregation.
Changes:
- Introduce
metric/x.WithUnsafeAttributes(andSettablesupport) to pass a raw[]attribute.KeyValuewithout copying at option construction time. - Update sync and async metric recording paths in
sdk/metricto extract raw attributes from options and resolve them into a finalattribute.Set. - Add unit tests and benchmark coverage for the new option; add a changelog entry.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/metric/meter.go | Observable Observe* paths now extract raw attributes and pass a resolved attribute.Set downstream. |
| sdk/metric/instrument.go | Adds raw attribute extraction + merging logic; sync instruments now resolve attributes before aggregation. |
| sdk/metric/instrument_test.go | Adds tests for raw extraction, merging semantics, and end-to-end recording across instrument types. |
| sdk/metric/benchmark_test.go | Adds benchmark cases for WithUnsafeAttributes in precomputed and dynamic scenarios. |
| metric/x/options.go | Adds WithUnsafeAttributes experimental option type + Set support. |
| metric/x/options_test.go | Adds basic test validating raw attribute storage behavior. |
| CHANGELOG.md | Documents the new experimental option. |
3adf683 to
8619a8f
Compare
dashpole
added a commit
that referenced
this pull request
Apr 23, 2026
I had avoided using Settable in our benchmarks in #8178 because I thought it would introduce a dependency on the x package in our go.mod file. But it turns out it doesn't (based on #8251). This will make it easier to compare WithAttributeSet to WithUnsafeAttributes. ``` │ before_bench.txt │ after_bench.txt │ │ sec/op │ sec/op vs base │ EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24 60.48n ± 7% 61.83n ± 20% ~ (p=1.000 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24 60.18n ± 9% 65.46n ± 8% ~ (p=0.065 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24 256.2n ± 6% 272.4n ± 18% +6.34% (p=0.041 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24 311.4n ± 18% 282.4n ± 26% ~ (p=0.132 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24 350.4n ± 13% 331.2n ± 45% ~ (p=0.818 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24 64.50n ± 10% 71.22n ± 11% ~ (p=0.093 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24 61.45n ± 15% 69.04n ± 18% ~ (p=0.180 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24 700.1n ± 36% 776.0n ± 22% ~ (p=0.394 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24 868.4n ± 14% 738.2n ± 8% -14.99% (p=0.015 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24 974.8n ± 19% 1083.5n ± 10% ~ (p=0.180 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24 67.68n ± 15% 64.42n ± 20% ~ (p=1.000 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24 67.59n ± 7% 63.41n ± 21% ~ (p=0.937 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24 1.310µ ± 27% 1.323µ ± 20% ~ (p=0.589 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24 2.077µ ± 34% 1.492µ ± 19% -28.15% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24 2.041µ ± 35% 1.977µ ± 43% ~ (p=0.485 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24 208.9n ± 7% 214.3n ± 12% ~ (p=0.784 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24 202.5n ± 6% 201.7n ± 19% ~ (p=0.937 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24 417.5n ± 7% 403.9n ± 16% ~ (p=0.394 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24 496.8n ± 13% 383.1n ± 8% -22.89% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24 542.8n ± 54% 521.7n ± 18% ~ (p=0.589 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24 732.6n ± 15% 822.3n ± 23% ~ (p=0.065 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24 803.0n ± 12% 813.9n ± 27% ~ (p=0.818 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24 1.389µ ± 28% 1.546µ ± 16% ~ (p=0.699 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24 1.756µ ± 12% 1.399µ ± 12% -20.36% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24 1.730µ ± 21% 1.824µ ± 20% ~ (p=0.818 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24 5.500µ ± 155% 1.433µ ± 22% -73.94% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24 2.566µ ± 65% 1.365µ ± 23% -46.82% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24 6.198µ ± 78% 3.188µ ± 14% -48.57% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24 5.343µ ± 63% 2.963µ ± 10% -44.55% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24 4.293µ ± 279% 3.213µ ± 30% ~ (p=0.065 n=6) geomean 591.5n 518.3n -12.37% │ before_bench.txt │ after_bench.txt │ │ B/op │ B/op vs base │ EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24 88.00 ± 0% 64.00 ± 0% -27.27% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24 152.00 ± 0% 64.00 ± 0% -57.89% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24 232.0 ± 0% 232.0 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24 344.0 ± 0% 320.0 ± 0% -6.98% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24 664.0 ± 0% 320.0 ± 0% -51.81% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24 1000.0 ± 0% 1000.0 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24 729.0 ± 0% 705.0 ± 0% -3.29% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24 1434.0 ± 0% 705.0 ± 0% -50.84% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24 2.102Ki ± 0% 2.102Ki ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24 64.00 ± 0% 64.00 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24 64.00 ± 0% 64.00 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24 152.0 ± 0% 128.0 ± 0% -15.79% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24 216.0 ± 0% 128.0 ± 0% -40.74% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24 296.0 ± 0% 296.0 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24 576.0 ± 0% 576.0 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24 576.0 ± 0% 576.0 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24 921.0 ± 0% 898.0 ± 0% -2.50% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24 1241.0 ± 0% 897.0 ± 0% -27.72% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24 1.539Ki ± 0% 1.539Ki ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24 1.312Ki ± 0% 1.312Ki ± 0% ~ (p=1.000 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24 1.312Ki ± 0% 1.312Ki ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24 2.025Ki ± 0% 2.004Ki ± 0% -1.06% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24 2.713Ki ± 0% 2.002Ki ± 0% -26.19% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24 3.414Ki ± 0% 3.414Ki ± 0% ~ (p=1.000 n=6) geomean ² -12.74% ² ¹ all samples are equal ² summaries must be >0 to compute geomean │ before_bench.txt │ after_bench.txt │ │ allocs/op │ allocs/op vs base │ EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24 2.000 ± 0% 1.000 ± 0% -50.00% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24 3.000 ± 0% 1.000 ± 0% -66.67% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24 5.000 ± 0% 5.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24 2.000 ± 0% 1.000 ± 0% -50.00% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24 3.000 ± 0% 1.000 ± 0% -66.67% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24 5.000 ± 0% 5.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24 2.000 ± 0% 1.000 ± 0% -50.00% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24 3.000 ± 0% 1.000 ± 0% -66.67% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24 5.000 ± 0% 5.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24 4.000 ± 0% 2.000 ± 0% -50.00% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24 6.000 ± 0% 6.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24 4.000 ± 0% 3.000 ± 0% -25.00% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24 5.000 ± 0% 3.000 ± 0% -40.00% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24 7.000 ± 0% 7.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24 4.000 ± 0% 3.000 ± 0% -25.00% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24 5.000 ± 0% 3.000 ± 0% -40.00% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24 7.000 ± 0% 7.000 ± 0% ~ (p=1.000 n=6) ¹ geomean ² -23.59% ² ¹ all samples are equal ² summaries must be >0 to compute geomean ```
pellared
pushed a commit
to pellared/opentelemetry-go
that referenced
this pull request
Apr 23, 2026
…lemetry#8252) I had avoided using Settable in our benchmarks in open-telemetry#8178 because I thought it would introduce a dependency on the x package in our go.mod file. But it turns out it doesn't (based on open-telemetry#8251). This will make it easier to compare WithAttributeSet to WithUnsafeAttributes. ``` │ before_bench.txt │ after_bench.txt │ │ sec/op │ sec/op vs base │ EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24 60.48n ± 7% 61.83n ± 20% ~ (p=1.000 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24 60.18n ± 9% 65.46n ± 8% ~ (p=0.065 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24 256.2n ± 6% 272.4n ± 18% +6.34% (p=0.041 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24 311.4n ± 18% 282.4n ± 26% ~ (p=0.132 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24 350.4n ± 13% 331.2n ± 45% ~ (p=0.818 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24 64.50n ± 10% 71.22n ± 11% ~ (p=0.093 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24 61.45n ± 15% 69.04n ± 18% ~ (p=0.180 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24 700.1n ± 36% 776.0n ± 22% ~ (p=0.394 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24 868.4n ± 14% 738.2n ± 8% -14.99% (p=0.015 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24 974.8n ± 19% 1083.5n ± 10% ~ (p=0.180 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24 67.68n ± 15% 64.42n ± 20% ~ (p=1.000 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24 67.59n ± 7% 63.41n ± 21% ~ (p=0.937 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24 1.310µ ± 27% 1.323µ ± 20% ~ (p=0.589 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24 2.077µ ± 34% 1.492µ ± 19% -28.15% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24 2.041µ ± 35% 1.977µ ± 43% ~ (p=0.485 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24 208.9n ± 7% 214.3n ± 12% ~ (p=0.784 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24 202.5n ± 6% 201.7n ± 19% ~ (p=0.937 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24 417.5n ± 7% 403.9n ± 16% ~ (p=0.394 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24 496.8n ± 13% 383.1n ± 8% -22.89% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24 542.8n ± 54% 521.7n ± 18% ~ (p=0.589 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24 732.6n ± 15% 822.3n ± 23% ~ (p=0.065 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24 803.0n ± 12% 813.9n ± 27% ~ (p=0.818 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24 1.389µ ± 28% 1.546µ ± 16% ~ (p=0.699 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24 1.756µ ± 12% 1.399µ ± 12% -20.36% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24 1.730µ ± 21% 1.824µ ± 20% ~ (p=0.818 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24 5.500µ ± 155% 1.433µ ± 22% -73.94% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24 2.566µ ± 65% 1.365µ ± 23% -46.82% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24 6.198µ ± 78% 3.188µ ± 14% -48.57% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24 5.343µ ± 63% 2.963µ ± 10% -44.55% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24 4.293µ ± 279% 3.213µ ± 30% ~ (p=0.065 n=6) geomean 591.5n 518.3n -12.37% │ before_bench.txt │ after_bench.txt │ │ B/op │ B/op vs base │ EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24 88.00 ± 0% 64.00 ± 0% -27.27% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24 152.00 ± 0% 64.00 ± 0% -57.89% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24 232.0 ± 0% 232.0 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24 344.0 ± 0% 320.0 ± 0% -6.98% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24 664.0 ± 0% 320.0 ± 0% -51.81% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24 1000.0 ± 0% 1000.0 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24 729.0 ± 0% 705.0 ± 0% -3.29% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24 1434.0 ± 0% 705.0 ± 0% -50.84% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24 2.102Ki ± 0% 2.102Ki ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24 64.00 ± 0% 64.00 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24 64.00 ± 0% 64.00 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24 152.0 ± 0% 128.0 ± 0% -15.79% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24 216.0 ± 0% 128.0 ± 0% -40.74% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24 296.0 ± 0% 296.0 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24 576.0 ± 0% 576.0 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24 576.0 ± 0% 576.0 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24 921.0 ± 0% 898.0 ± 0% -2.50% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24 1241.0 ± 0% 897.0 ± 0% -27.72% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24 1.539Ki ± 0% 1.539Ki ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24 1.312Ki ± 0% 1.312Ki ± 0% ~ (p=1.000 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24 1.312Ki ± 0% 1.312Ki ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24 2.025Ki ± 0% 2.004Ki ± 0% -1.06% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24 2.713Ki ± 0% 2.002Ki ± 0% -26.19% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24 3.414Ki ± 0% 3.414Ki ± 0% ~ (p=1.000 n=6) geomean ² -12.74% ² ¹ all samples are equal ² summaries must be >0 to compute geomean │ before_bench.txt │ after_bench.txt │ │ allocs/op │ allocs/op vs base │ EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributeSet-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/1/Precomputed/WithAttributes-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributeSet-24 2.000 ± 0% 1.000 ± 0% -50.00% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Dynamic/WithAttributes-24 3.000 ± 0% 1.000 ± 0% -66.67% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/1/Naive/WithAttributes-24 5.000 ± 0% 5.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributeSet-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/5/Precomputed/WithAttributes-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributeSet-24 2.000 ± 0% 1.000 ± 0% -50.00% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Dynamic/WithAttributes-24 3.000 ± 0% 1.000 ± 0% -66.67% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/5/Naive/WithAttributes-24 5.000 ± 0% 5.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributeSet-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/10/Precomputed/WithAttributes-24 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributeSet-24 2.000 ± 0% 1.000 ± 0% -50.00% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Dynamic/WithAttributes-24 3.000 ± 0% 1.000 ± 0% -66.67% (p=0.002 n=6) EndToEndCounterAdd/NoFilter/Attributes/10/Naive/WithAttributes-24 5.000 ± 0% 5.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributeSet-24 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/1/Precomputed/WithAttributes-24 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributeSet-24 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Dynamic/WithAttributes-24 4.000 ± 0% 2.000 ± 0% -50.00% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/1/Naive/WithAttributes-24 6.000 ± 0% 6.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributeSet-24 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/5/Precomputed/WithAttributes-24 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributeSet-24 4.000 ± 0% 3.000 ± 0% -25.00% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Dynamic/WithAttributes-24 5.000 ± 0% 3.000 ± 0% -40.00% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/5/Naive/WithAttributes-24 7.000 ± 0% 7.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributeSet-24 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/10/Precomputed/WithAttributes-24 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=6) ¹ EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributeSet-24 4.000 ± 0% 3.000 ± 0% -25.00% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Dynamic/WithAttributes-24 5.000 ± 0% 3.000 ± 0% -40.00% (p=0.002 n=6) EndToEndCounterAdd/Filtered/Attributes/10/Naive/WithAttributes-24 7.000 ± 0% 7.000 ± 0% ~ (p=1.000 n=6) ¹ geomean ² -23.59% ² ¹ all samples are equal ² summaries must be >0 to compute geomean ```
MrAlias
reviewed
Apr 30, 2026
794cd9a to
a9fdc3c
Compare
MrAlias
approved these changes
May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split from #8179
Part of #7743
This just defines the new WithUnsafeAttributes option, but converts it to a set, and leaves the optimization of that path for a follow-up.
Benchmarks