Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Sortable #4734

Merged
merged 9 commits into from
Mar 11, 2024
Merged

Deprecate Sortable #4734

merged 9 commits into from
Mar 11, 2024

Conversation

ash2k
Copy link
Contributor

@ash2k ash2k commented Nov 30, 2023

I wonder what was the reason for introducing the methods with *Sortable in the first place? Code in this PR works fine, but I couldn't find the benchmarks from #3832 to see if it allocates more or is slower. Any pointers?

I ran the existing benchmarks and the results are identical old vs new on both Go 1.20.10 and 1.21.4.

1.20.10, old vs new:

goos: darwin
goarch: arm64
pkg: go.opentelemetry.io/otel/attribute
                               │ old_1.20.10.txt │           new_1.20.10.txt           │
                               │     sec/op      │    sec/op     vs base               │
Bool/Value-10                       0.9341n ± 0%   0.9343n ± 0%       ~ (p=0.668 n=10)
Bool/KeyValue-10                     4.639n ± 0%    4.649n ± 0%       ~ (p=0.086 n=10)
Bool/AsBool-10                      0.7567n ± 0%   0.7613n ± 0%  +0.61% (p=0.000 n=10)
Bool/Emit-10                         4.295n ± 0%    4.301n ± 1%       ~ (p=0.171 n=10)
BoolSlice/Value-10                   91.53n ± 0%    91.55n ± 1%       ~ (p=0.517 n=10)
BoolSlice/KeyValue-10                93.11n ± 0%    93.20n ± 0%       ~ (p=0.323 n=10)
BoolSlice/AsBoolSlice-10             94.30n ± 0%    94.58n ± 1%  +0.29% (p=0.009 n=10)
BoolSlice/Emit-10                    293.5n ± 0%    294.7n ± 1%  +0.41% (p=0.002 n=10)
Int/Value-10                        0.9346n ± 0%   0.9339n ± 0%  -0.07% (p=0.024 n=10)
Int/KeyValue-10                      4.636n ± 0%    4.635n ± 0%       ~ (p=0.839 n=10)
Int/Emit-10                          4.983n ± 0%    4.906n ± 1%  -1.55% (p=0.000 n=10)
IntSlice/Value-10                    85.59n ± 0%    85.33n ± 1%       ~ (p=0.119 n=10)
IntSlice/KeyValue-10                 87.71n ± 0%    87.81n ± 0%       ~ (p=0.425 n=10)
IntSlice/Emit-10                     362.1n ± 0%    361.5n ± 0%       ~ (p=0.323 n=10)
Int64/Value-10                      0.9340n ± 0%   0.9336n ± 0%       ~ (p=0.169 n=10)
Int64/KeyValue-10                    4.639n ± 0%    4.649n ± 0%       ~ (p=0.197 n=10)
Int64/AsInt64-10                    0.7554n ± 0%   0.7549n ± 0%       ~ (p=0.270 n=10)
Int64/Emit-10                        5.159n ± 1%    5.271n ± 1%  +2.17% (p=0.002 n=10)
Int64Slice/Value-10                  103.4n ± 1%    103.4n ± 1%       ~ (p=0.838 n=10)
Int64Slice/KeyValue-10               105.0n ± 1%    104.8n ± 1%       ~ (p=0.283 n=10)
Int64Slice/AsInt64Slice-10           99.58n ± 0%    99.59n ± 0%       ~ (p=0.839 n=10)
Int64Slice/Emit-10                   361.4n ± 0%    361.5n ± 1%       ~ (p=0.342 n=10)
Float64/Value-10                    0.9353n ± 0%   0.9353n ± 0%       ~ (p=0.985 n=10)
Float64/KeyValue-10                  4.639n ± 0%    4.648n ± 0%       ~ (p=0.147 n=10)
Float64/AsFloat64-10                0.7501n ± 0%   0.7501n ± 0%       ~ (p=0.515 n=10)
Float64/Emit-10                      75.85n ± 1%    75.70n ± 0%       ~ (p=0.148 n=10)
Float64Slice/Value-10                105.5n ± 1%    105.4n ± 0%       ~ (p=0.838 n=10)
Float64Slice/KeyValue-10             106.8n ± 0%    106.8n ± 1%       ~ (p=0.845 n=10)
Float64Slice/AsFloat64Slice-10       101.7n ± 0%    101.6n ± 0%       ~ (p=0.354 n=10)
Float64Slice/Emit-10                 440.7n ± 1%    440.7n ± 0%       ~ (p=0.895 n=10)
String/Value-10                      1.247n ± 0%    1.248n ± 0%       ~ (p=0.088 n=10)
String/KeyValue-10                   4.614n ± 0%    4.609n ± 0%  -0.11% (p=0.003 n=10)
String/AsString-10                   1.075n ± 0%    1.070n ± 0%  -0.42% (p=0.000 n=10)
String/Emit-10                       3.248n ± 0%    3.241n ± 0%  -0.23% (p=0.012 n=10)
StringSlice/Value-10                 120.8n ± 0%    121.2n ± 0%       ~ (p=0.115 n=10)
StringSlice/KeyValue-10              122.3n ± 0%    122.9n ± 1%  +0.45% (p=0.015 n=10)
StringSlice/AsStringSlice-10         109.3n ± 0%    109.5n ± 0%       ~ (p=0.951 n=10)
StringSlice/Emit-10                  371.1n ± 1%    370.1n ± 0%  -0.27% (p=0.017 n=10)
geomean                              18.65n         18.66n       +0.04%

                               │ old_1.20.10.txt │           new_1.20.10.txt           │
                               │      B/op       │    B/op     vs base                 │
Bool/Value-10                       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Bool/KeyValue-10                    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Bool/AsBool-10                      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Bool/Emit-10                        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
BoolSlice/Value-10                  30.00 ± 0%     30.00 ± 0%       ~ (p=1.000 n=10) ¹
BoolSlice/KeyValue-10               30.00 ± 0%     30.00 ± 0%       ~ (p=1.000 n=10) ¹
BoolSlice/AsBoolSlice-10            27.00 ± 0%     27.00 ± 0%       ~ (p=1.000 n=10) ¹
BoolSlice/Emit-10                   78.00 ± 0%     78.00 ± 0%       ~ (p=1.000 n=10) ¹
Int/Value-10                        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Int/KeyValue-10                     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Int/Emit-10                         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
IntSlice/Value-10                   48.00 ± 0%     48.00 ± 0%       ~ (p=1.000 n=10) ¹
IntSlice/KeyValue-10                48.00 ± 0%     48.00 ± 0%       ~ (p=1.000 n=10) ¹
IntSlice/Emit-10                    112.0 ± 0%     112.0 ± 0%       ~ (p=1.000 n=10) ¹
Int64/Value-10                      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Int64/KeyValue-10                   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Int64/AsInt64-10                    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Int64/Emit-10                       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Int64Slice/Value-10                 72.00 ± 0%     72.00 ± 0%       ~ (p=1.000 n=10) ¹
Int64Slice/KeyValue-10              72.00 ± 0%     72.00 ± 0%       ~ (p=1.000 n=10) ¹
Int64Slice/AsInt64Slice-10          48.00 ± 0%     48.00 ± 0%       ~ (p=1.000 n=10) ¹
Int64Slice/Emit-10                  112.0 ± 0%     112.0 ± 0%       ~ (p=1.000 n=10) ¹
Float64/Value-10                    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Float64/KeyValue-10                 0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Float64/AsFloat64-10                0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Float64/Emit-10                     16.00 ± 0%     16.00 ± 0%       ~ (p=1.000 n=10) ¹
Float64Slice/Value-10               72.00 ± 0%     72.00 ± 0%       ~ (p=1.000 n=10) ¹
Float64Slice/KeyValue-10            72.00 ± 0%     72.00 ± 0%       ~ (p=1.000 n=10) ¹
Float64Slice/AsFloat64Slice-10      48.00 ± 0%     48.00 ± 0%       ~ (p=1.000 n=10) ¹
Float64Slice/Emit-10                112.0 ± 0%     112.0 ± 0%       ~ (p=1.000 n=10) ¹
String/Value-10                     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
String/KeyValue-10                  0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
String/AsString-10                  0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
String/Emit-10                      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
StringSlice/Value-10                120.0 ± 0%     120.0 ± 0%       ~ (p=1.000 n=10) ¹
StringSlice/KeyValue-10             120.0 ± 0%     120.0 ± 0%       ~ (p=1.000 n=10) ¹
StringSlice/AsStringSlice-10        72.00 ± 0%     72.00 ± 0%       ~ (p=1.000 n=10) ¹
StringSlice/Emit-10                 192.0 ± 0%     192.0 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                        ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                               │ old_1.20.10.txt │           new_1.20.10.txt           │
                               │    allocs/op    │ allocs/op   vs base                 │
Bool/Value-10                       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Bool/KeyValue-10                    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Bool/AsBool-10                      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Bool/Emit-10                        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
BoolSlice/Value-10                  3.000 ± 0%     3.000 ± 0%       ~ (p=1.000 n=10) ¹
BoolSlice/KeyValue-10               3.000 ± 0%     3.000 ± 0%       ~ (p=1.000 n=10) ¹
BoolSlice/AsBoolSlice-10            2.000 ± 0%     2.000 ± 0%       ~ (p=1.000 n=10) ¹
BoolSlice/Emit-10                   7.000 ± 0%     7.000 ± 0%       ~ (p=1.000 n=10) ¹
Int/Value-10                        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Int/KeyValue-10                     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Int/Emit-10                         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
IntSlice/Value-10                   2.000 ± 0%     2.000 ± 0%       ~ (p=1.000 n=10) ¹
IntSlice/KeyValue-10                2.000 ± 0%     2.000 ± 0%       ~ (p=1.000 n=10) ¹
IntSlice/Emit-10                    7.000 ± 0%     7.000 ± 0%       ~ (p=1.000 n=10) ¹
Int64/Value-10                      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Int64/KeyValue-10                   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Int64/AsInt64-10                    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Int64/Emit-10                       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Int64Slice/Value-10                 3.000 ± 0%     3.000 ± 0%       ~ (p=1.000 n=10) ¹
Int64Slice/KeyValue-10              3.000 ± 0%     3.000 ± 0%       ~ (p=1.000 n=10) ¹
Int64Slice/AsInt64Slice-10          2.000 ± 0%     2.000 ± 0%       ~ (p=1.000 n=10) ¹
Int64Slice/Emit-10                  7.000 ± 0%     7.000 ± 0%       ~ (p=1.000 n=10) ¹
Float64/Value-10                    0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Float64/KeyValue-10                 0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Float64/AsFloat64-10                0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Float64/Emit-10                     2.000 ± 0%     2.000 ± 0%       ~ (p=1.000 n=10) ¹
Float64Slice/Value-10               3.000 ± 0%     3.000 ± 0%       ~ (p=1.000 n=10) ¹
Float64Slice/KeyValue-10            3.000 ± 0%     3.000 ± 0%       ~ (p=1.000 n=10) ¹
Float64Slice/AsFloat64Slice-10      2.000 ± 0%     2.000 ± 0%       ~ (p=1.000 n=10) ¹
Float64Slice/Emit-10                7.000 ± 0%     7.000 ± 0%       ~ (p=1.000 n=10) ¹
String/Value-10                     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
String/KeyValue-10                  0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
String/AsString-10                  0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
String/Emit-10                      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
StringSlice/Value-10                3.000 ± 0%     3.000 ± 0%       ~ (p=1.000 n=10) ¹
StringSlice/KeyValue-10             3.000 ± 0%     3.000 ± 0%       ~ (p=1.000 n=10) ¹
StringSlice/AsStringSlice-10        2.000 ± 0%     2.000 ± 0%       ~ (p=1.000 n=10) ¹
StringSlice/Emit-10                 7.000 ± 0%     7.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                        ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

1.21.4, old vs new:

goos: darwin
goarch: arm64
pkg: go.opentelemetry.io/otel/attribute
                               │ old_1.21.4.txt │            new_1.21.4.txt             │
                               │     sec/op     │    sec/op      vs base                │
Bool/Value-10                      1.245n ± ∞ ¹    1.245n ± ∞ ¹       ~ (p=1.000 n=3) ²
Bool/KeyValue-10                   4.652n ± ∞ ¹    4.650n ± ∞ ¹       ~ (p=1.000 n=3) ²
Bool/AsBool-10                    0.7224n ± ∞ ¹   0.7514n ± ∞ ¹       ~ (p=0.100 n=3) ²
Bool/Emit-10                       4.297n ± ∞ ¹    4.329n ± ∞ ¹       ~ (p=0.100 n=3) ²
BoolSlice/Value-10                 89.94n ± ∞ ¹    89.70n ± ∞ ¹       ~ (p=0.400 n=3) ²
BoolSlice/KeyValue-10              91.09n ± ∞ ¹    90.40n ± ∞ ¹       ~ (p=0.200 n=3) ²
BoolSlice/AsBoolSlice-10           92.45n ± ∞ ¹    91.50n ± ∞ ¹       ~ (p=0.100 n=3) ²
BoolSlice/Emit-10                  299.2n ± ∞ ¹    295.1n ± ∞ ¹       ~ (p=0.100 n=3) ²
Int/Value-10                       1.245n ± ∞ ¹    1.245n ± ∞ ¹       ~ (p=1.000 n=3) ²
Int/KeyValue-10                    4.651n ± ∞ ¹    4.661n ± ∞ ¹       ~ (p=0.600 n=3) ²
Int/Emit-10                        5.295n ± ∞ ¹    5.044n ± ∞ ¹       ~ (p=0.700 n=3) ²
IntSlice/Value-10                  82.25n ± ∞ ¹    82.45n ± ∞ ¹       ~ (p=0.700 n=3) ²
IntSlice/KeyValue-10               85.25n ± ∞ ¹    85.34n ± ∞ ¹       ~ (p=0.100 n=3) ²
IntSlice/Emit-10                   347.9n ± ∞ ¹    347.3n ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64/Value-10                     1.245n ± ∞ ¹    1.246n ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64/KeyValue-10                  4.647n ± ∞ ¹    4.641n ± ∞ ¹       ~ (p=0.700 n=3) ²
Int64/AsInt64-10                  0.7051n ± ∞ ¹   0.7507n ± ∞ ¹       ~ (p=0.100 n=3) ²
Int64/Emit-10                      4.933n ± ∞ ¹    5.210n ± ∞ ¹       ~ (p=0.100 n=3) ²
Int64Slice/Value-10                100.9n ± ∞ ¹    100.4n ± ∞ ¹       ~ (p=0.100 n=3) ²
Int64Slice/KeyValue-10             103.0n ± ∞ ¹    101.8n ± ∞ ¹       ~ (p=0.100 n=3) ²
Int64Slice/AsInt64Slice-10         97.17n ± ∞ ¹    97.35n ± ∞ ¹       ~ (p=0.800 n=3) ²
Int64Slice/Emit-10                 351.4n ± ∞ ¹    348.0n ± ∞ ¹       ~ (p=0.200 n=3) ²
Float64/Value-10                   1.244n ± ∞ ¹    1.245n ± ∞ ¹       ~ (p=0.400 n=3) ²
Float64/KeyValue-10                4.651n ± ∞ ¹    4.655n ± ∞ ¹       ~ (p=0.400 n=3) ²
Float64/AsFloat64-10              0.7055n ± ∞ ¹   0.7510n ± ∞ ¹       ~ (p=0.100 n=3) ²
Float64/Emit-10                    75.97n ± ∞ ¹    76.66n ± ∞ ¹       ~ (p=0.100 n=3) ²
Float64Slice/Value-10              101.9n ± ∞ ¹    102.1n ± ∞ ¹       ~ (p=0.400 n=3) ²
Float64Slice/KeyValue-10           104.0n ± ∞ ¹    103.6n ± ∞ ¹       ~ (p=0.100 n=3) ²
Float64Slice/AsFloat64Slice-10     98.74n ± ∞ ¹    98.65n ± ∞ ¹       ~ (p=0.700 n=3) ²
Float64Slice/Emit-10               436.2n ± ∞ ¹    436.9n ± ∞ ¹       ~ (p=1.000 n=3) ²
String/Value-10                    1.713n ± ∞ ¹    1.713n ± ∞ ¹       ~ (p=0.800 n=3) ²
String/KeyValue-10                 4.649n ± ∞ ¹    4.650n ± ∞ ¹       ~ (p=0.900 n=3) ²
String/AsString-10                0.9805n ± ∞ ¹   1.0600n ± ∞ ¹       ~ (p=0.100 n=3) ²
String/Emit-10                     3.266n ± ∞ ¹    3.242n ± ∞ ¹       ~ (p=0.100 n=3) ²
StringSlice/Value-10               118.3n ± ∞ ¹    118.6n ± ∞ ¹       ~ (p=0.500 n=3) ²
StringSlice/KeyValue-10            120.7n ± ∞ ¹    120.5n ± ∞ ¹       ~ (p=1.000 n=3) ²
StringSlice/AsStringSlice-10       107.2n ± ∞ ¹    107.0n ± ∞ ¹       ~ (p=0.500 n=3) ²
StringSlice/Emit-10                363.3n ± ∞ ¹    356.9n ± ∞ ¹       ~ (p=0.100 n=3) ²
geomean                            19.05n          19.15n        +0.48%
¹ need >= 6 samples for confidence interval at level 0.95
² need >= 4 samples to detect a difference at alpha level 0.05

                               │ old_1.21.4.txt │           new_1.21.4.txt            │
                               │      B/op      │    B/op      vs base                │
Bool/Value-10                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Bool/KeyValue-10                    0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Bool/AsBool-10                      0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Bool/Emit-10                        0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
BoolSlice/Value-10                  30.00 ± ∞ ¹   30.00 ± ∞ ¹       ~ (p=1.000 n=3) ²
BoolSlice/KeyValue-10               30.00 ± ∞ ¹   30.00 ± ∞ ¹       ~ (p=1.000 n=3) ²
BoolSlice/AsBoolSlice-10            27.00 ± ∞ ¹   27.00 ± ∞ ¹       ~ (p=1.000 n=3) ²
BoolSlice/Emit-10                   78.00 ± ∞ ¹   78.00 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int/Value-10                        0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int/KeyValue-10                     0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int/Emit-10                         0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
IntSlice/Value-10                   48.00 ± ∞ ¹   48.00 ± ∞ ¹       ~ (p=1.000 n=3) ²
IntSlice/KeyValue-10                48.00 ± ∞ ¹   48.00 ± ∞ ¹       ~ (p=1.000 n=3) ²
IntSlice/Emit-10                    112.0 ± ∞ ¹   112.0 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64/Value-10                      0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64/KeyValue-10                   0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64/AsInt64-10                    0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64/Emit-10                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64Slice/Value-10                 72.00 ± ∞ ¹   72.00 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64Slice/KeyValue-10              72.00 ± ∞ ¹   72.00 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64Slice/AsInt64Slice-10          48.00 ± ∞ ¹   48.00 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64Slice/Emit-10                  112.0 ± ∞ ¹   112.0 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64/Value-10                    0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64/KeyValue-10                 0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64/AsFloat64-10                0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64/Emit-10                     16.00 ± ∞ ¹   16.00 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64Slice/Value-10               72.00 ± ∞ ¹   72.00 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64Slice/KeyValue-10            72.00 ± ∞ ¹   72.00 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64Slice/AsFloat64Slice-10      48.00 ± ∞ ¹   48.00 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64Slice/Emit-10                112.0 ± ∞ ¹   112.0 ± ∞ ¹       ~ (p=1.000 n=3) ²
String/Value-10                     0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
String/KeyValue-10                  0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
String/AsString-10                  0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
String/Emit-10                      0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
StringSlice/Value-10                120.0 ± ∞ ¹   120.0 ± ∞ ¹       ~ (p=1.000 n=3) ²
StringSlice/KeyValue-10             120.0 ± ∞ ¹   120.0 ± ∞ ¹       ~ (p=1.000 n=3) ²
StringSlice/AsStringSlice-10        72.00 ± ∞ ¹   72.00 ± ∞ ¹       ~ (p=1.000 n=3) ²
StringSlice/Emit-10                 192.0 ± ∞ ¹   192.0 ± ∞ ¹       ~ (p=1.000 n=3) ²
geomean                                       ³                +0.00%               ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean

                               │ old_1.21.4.txt │           new_1.21.4.txt            │
                               │   allocs/op    │  allocs/op   vs base                │
Bool/Value-10                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Bool/KeyValue-10                    0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Bool/AsBool-10                      0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Bool/Emit-10                        0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
BoolSlice/Value-10                  3.000 ± ∞ ¹   3.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
BoolSlice/KeyValue-10               3.000 ± ∞ ¹   3.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
BoolSlice/AsBoolSlice-10            2.000 ± ∞ ¹   2.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
BoolSlice/Emit-10                   7.000 ± ∞ ¹   7.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int/Value-10                        0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int/KeyValue-10                     0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int/Emit-10                         0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
IntSlice/Value-10                   2.000 ± ∞ ¹   2.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
IntSlice/KeyValue-10                2.000 ± ∞ ¹   2.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
IntSlice/Emit-10                    7.000 ± ∞ ¹   7.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64/Value-10                      0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64/KeyValue-10                   0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64/AsInt64-10                    0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64/Emit-10                       0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64Slice/Value-10                 3.000 ± ∞ ¹   3.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64Slice/KeyValue-10              3.000 ± ∞ ¹   3.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64Slice/AsInt64Slice-10          2.000 ± ∞ ¹   2.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Int64Slice/Emit-10                  7.000 ± ∞ ¹   7.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64/Value-10                    0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64/KeyValue-10                 0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64/AsFloat64-10                0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64/Emit-10                     2.000 ± ∞ ¹   2.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64Slice/Value-10               3.000 ± ∞ ¹   3.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64Slice/KeyValue-10            3.000 ± ∞ ¹   3.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64Slice/AsFloat64Slice-10      2.000 ± ∞ ¹   2.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
Float64Slice/Emit-10                7.000 ± ∞ ¹   7.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
String/Value-10                     0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
String/KeyValue-10                  0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
String/AsString-10                  0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
String/Emit-10                      0.000 ± ∞ ¹   0.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
StringSlice/Value-10                3.000 ± ∞ ¹   3.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
StringSlice/KeyValue-10             3.000 ± ∞ ¹   3.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
StringSlice/AsStringSlice-10        2.000 ± ∞ ¹   2.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
StringSlice/Emit-10                 7.000 ± ∞ ¹   7.000 ± ∞ ¹       ~ (p=1.000 n=3) ²
geomean                                       ³                +0.00%               ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean

New code, 1.20.10 vs 1.21.4:

goos: darwin
goarch: arm64
pkg: go.opentelemetry.io/otel/attribute
                               │ new_1.20.10.txt │             new_1.21.4.txt              │
                               │     sec/op      │    sec/op      vs base                  │
Bool/Value-10                       0.9343n ± 0%   1.2450n ± ∞ ¹  +33.26% (p=0.007 n=10+3)
Bool/KeyValue-10                     4.649n ± 0%    4.650n ± ∞ ¹        ~ (p=0.573 n=10+3)
Bool/AsBool-10                      0.7613n ± 0%   0.7514n ± ∞ ¹   -1.30% (p=0.007 n=10+3)
Bool/Emit-10                         4.301n ± 1%    4.329n ± ∞ ¹        ~ (p=0.077 n=10+3)
BoolSlice/Value-10                   91.55n ± 1%    89.70n ± ∞ ¹   -2.02% (p=0.007 n=10+3)
BoolSlice/KeyValue-10                93.20n ± 0%    90.40n ± ∞ ¹   -3.00% (p=0.007 n=10+3)
BoolSlice/AsBoolSlice-10             94.58n ± 1%    91.50n ± ∞ ¹   -3.25% (p=0.007 n=10+3)
BoolSlice/Emit-10                    294.7n ± 1%    295.1n ± ∞ ¹        ~ (p=0.315 n=10+3)
Int/Value-10                        0.9339n ± 0%   1.2450n ± ∞ ¹  +33.31% (p=0.007 n=10+3)
Int/KeyValue-10                      4.635n ± 0%    4.661n ± ∞ ¹   +0.57% (p=0.021 n=10+3)
Int/Emit-10                          4.906n ± 1%    5.044n ± ∞ ¹   +2.80% (p=0.007 n=10+3)
IntSlice/Value-10                    85.33n ± 1%    82.45n ± ∞ ¹   -3.38% (p=0.007 n=10+3)
IntSlice/KeyValue-10                 87.81n ± 0%    85.34n ± ∞ ¹   -2.82% (p=0.007 n=10+3)
IntSlice/Emit-10                     361.5n ± 0%    347.3n ± ∞ ¹   -3.93% (p=0.007 n=10+3)
Int64/Value-10                      0.9336n ± 0%   1.2460n ± ∞ ¹  +33.45% (p=0.007 n=10+3)
Int64/KeyValue-10                    4.649n ± 0%    4.641n ± ∞ ¹        ~ (p=0.811 n=10+3)
Int64/AsInt64-10                    0.7549n ± 0%   0.7507n ± ∞ ¹   -0.55% (p=0.007 n=10+3)
Int64/Emit-10                        5.271n ± 1%    5.210n ± ∞ ¹        ~ (p=0.371 n=10+3)
Int64Slice/Value-10                  103.4n ± 1%    100.4n ± ∞ ¹   -2.90% (p=0.007 n=10+3)
Int64Slice/KeyValue-10               104.8n ± 1%    101.8n ± ∞ ¹   -2.91% (p=0.007 n=10+3)
Int64Slice/AsInt64Slice-10           99.59n ± 0%    97.35n ± ∞ ¹   -2.25% (p=0.007 n=10+3)
Int64Slice/Emit-10                   361.5n ± 1%    348.0n ± ∞ ¹   -3.73% (p=0.007 n=10+3)
Float64/Value-10                    0.9353n ± 0%   1.2450n ± ∞ ¹  +33.12% (p=0.007 n=10+3)
Float64/KeyValue-10                  4.648n ± 0%    4.655n ± ∞ ¹        ~ (p=0.077 n=10+3)
Float64/AsFloat64-10                0.7501n ± 0%   0.7510n ± ∞ ¹        ~ (p=0.168 n=10+3)
Float64/Emit-10                      75.70n ± 0%    76.66n ± ∞ ¹   +1.26% (p=0.007 n=10+3)
Float64Slice/Value-10                105.4n ± 0%    102.1n ± ∞ ¹   -3.13% (n=10+3)
Float64Slice/KeyValue-10             106.8n ± 1%    103.6n ± ∞ ¹   -3.00% (p=0.007 n=10+3)
Float64Slice/AsFloat64Slice-10      101.60n ± 0%    98.65n ± ∞ ¹   -2.90% (n=10+3)
Float64Slice/Emit-10                 440.7n ± 0%    436.9n ± ∞ ¹   -0.85% (n=10+3)
String/Value-10                      1.248n ± 0%    1.713n ± ∞ ¹  +37.31% (p=0.007 n=10+3)
String/KeyValue-10                   4.609n ± 0%    4.650n ± ∞ ¹   +0.88% (p=0.007 n=10+3)
String/AsString-10                   1.070n ± 0%    1.060n ± ∞ ¹   -0.93% (n=10+3)
String/Emit-10                       3.241n ± 0%    3.242n ± ∞ ¹        ~ (p=0.713 n=10+3)
StringSlice/Value-10                 121.2n ± 0%    118.6n ± ∞ ¹   -2.15% (p=0.007 n=10+3)
StringSlice/KeyValue-10              122.9n ± 1%    120.5n ± ∞ ¹   -1.91% (p=0.007 n=10+3)
StringSlice/AsStringSlice-10         109.5n ± 0%    107.0n ± ∞ ¹   -2.24% (n=10+3)
StringSlice/Emit-10                  370.1n ± 0%    356.9n ± ∞ ¹   -3.57% (p=0.007 n=10+3)
geomean                              18.66n         19.15n         +2.62%
¹ need >= 6 samples for confidence interval at level 0.95

                               │ new_1.20.10.txt │             new_1.21.4.txt             │
                               │      B/op       │    B/op      vs base                   │
Bool/Value-10                       0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Bool/KeyValue-10                    0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Bool/AsBool-10                      0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Bool/Emit-10                        0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
BoolSlice/Value-10                  30.00 ± 0%     30.00 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
BoolSlice/KeyValue-10               30.00 ± 0%     30.00 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
BoolSlice/AsBoolSlice-10            27.00 ± 0%     27.00 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
BoolSlice/Emit-10                   78.00 ± 0%     78.00 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int/Value-10                        0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int/KeyValue-10                     0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int/Emit-10                         0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
IntSlice/Value-10                   48.00 ± 0%     48.00 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
IntSlice/KeyValue-10                48.00 ± 0%     48.00 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
IntSlice/Emit-10                    112.0 ± 0%     112.0 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64/Value-10                      0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64/KeyValue-10                   0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64/AsInt64-10                    0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64/Emit-10                       0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64Slice/Value-10                 72.00 ± 0%     72.00 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64Slice/KeyValue-10              72.00 ± 0%     72.00 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64Slice/AsInt64Slice-10          48.00 ± 0%     48.00 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64Slice/Emit-10                  112.0 ± 0%     112.0 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64/Value-10                    0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64/KeyValue-10                 0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64/AsFloat64-10                0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64/Emit-10                     16.00 ± 0%     16.00 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64Slice/Value-10               72.00 ± 0%     72.00 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64Slice/KeyValue-10            72.00 ± 0%     72.00 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64Slice/AsFloat64Slice-10      48.00 ± 0%     48.00 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64Slice/Emit-10                112.0 ± 0%     112.0 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
String/Value-10                     0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
String/KeyValue-10                  0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
String/AsString-10                  0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
String/Emit-10                      0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
StringSlice/Value-10                120.0 ± 0%     120.0 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
StringSlice/KeyValue-10             120.0 ± 0%     120.0 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
StringSlice/AsStringSlice-10        72.00 ± 0%     72.00 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
StringSlice/Emit-10                 192.0 ± 0%     192.0 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
geomean                                        ³                +0.00%                  ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean

                               │ new_1.20.10.txt │             new_1.21.4.txt             │
                               │    allocs/op    │  allocs/op   vs base                   │
Bool/Value-10                       0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Bool/KeyValue-10                    0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Bool/AsBool-10                      0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Bool/Emit-10                        0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
BoolSlice/Value-10                  3.000 ± 0%     3.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
BoolSlice/KeyValue-10               3.000 ± 0%     3.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
BoolSlice/AsBoolSlice-10            2.000 ± 0%     2.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
BoolSlice/Emit-10                   7.000 ± 0%     7.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int/Value-10                        0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int/KeyValue-10                     0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int/Emit-10                         0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
IntSlice/Value-10                   2.000 ± 0%     2.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
IntSlice/KeyValue-10                2.000 ± 0%     2.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
IntSlice/Emit-10                    7.000 ± 0%     7.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64/Value-10                      0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64/KeyValue-10                   0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64/AsInt64-10                    0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64/Emit-10                       0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64Slice/Value-10                 3.000 ± 0%     3.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64Slice/KeyValue-10              3.000 ± 0%     3.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64Slice/AsInt64Slice-10          2.000 ± 0%     2.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Int64Slice/Emit-10                  7.000 ± 0%     7.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64/Value-10                    0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64/KeyValue-10                 0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64/AsFloat64-10                0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64/Emit-10                     2.000 ± 0%     2.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64Slice/Value-10               3.000 ± 0%     3.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64Slice/KeyValue-10            3.000 ± 0%     3.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64Slice/AsFloat64Slice-10      2.000 ± 0%     2.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
Float64Slice/Emit-10                7.000 ± 0%     7.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
String/Value-10                     0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
String/KeyValue-10                  0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
String/AsString-10                  0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
String/Emit-10                      0.000 ± 0%     0.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
StringSlice/Value-10                3.000 ± 0%     3.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
StringSlice/KeyValue-10             3.000 ± 0%     3.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
StringSlice/AsStringSlice-10        2.000 ± 0%     2.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
StringSlice/Emit-10                 7.000 ± 0%     7.000 ± ∞ ¹       ~ (p=1.000 n=10+3) ²
geomean                                        ³                +0.00%                  ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean

There are some performance differences (not allocations though), but I only ran count=3 for the 1.21 version as I'm short on time today. I'll re-run that tomorrow with count=10 to improve accuracy.

Copy link

codecov bot commented Nov 30, 2023

Codecov Report

Attention: Patch coverage is 50.00000% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 83.4%. Comparing base (2d968c4) to head (fd2da8a).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #4734     +/-   ##
=======================================
- Coverage   83.5%   83.4%   -0.1%     
=======================================
  Files        238     238             
  Lines      15757   15745     -12     
=======================================
- Hits       13159   13143     -16     
- Misses      2309    2314      +5     
+ Partials     289     288      -1     
Files Coverage Δ
attribute/set.go 74.5% <50.0%> (-3.8%) ⬇️

@pellared
Copy link
Member

pellared commented Dec 6, 2023

CC @MrAlias

MrAlias
MrAlias previously requested changes Dec 6, 2023
Copy link
Contributor

@MrAlias MrAlias left a comment

Choose a reason for hiding this comment

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

This looks to removes the amortized allocations from NewSet and the removal of an allocation for NewSetWithSortableFiltered. Please show this doesn't add an additional allocation before this can be considered.

@ash2k
Copy link
Contributor Author

ash2k commented Dec 11, 2023

I've added a new benchmark that exercises the NewSetWithSortableFiltered() function directly. Here are the results:

main:
BenchmarkNewSetWithSortableFiltered-10    	 8248227	       138.4 ns/op	     448 B/op	       1 allocs/op

branch:
BenchmarkNewSetWithSortableFiltered-10    	 6625119	       177.0 ns/op	     448 B/op	       1 allocs/op

Because we are testing sorting, actual performance depends on the data being sorted. But this branch performs 1 allocation too.

@ash2k ash2k force-pushed the remove-sortable branch 2 times, most recently from 7b76af7 to c52d3d0 Compare December 11, 2023 02:35
@MrAlias
Copy link
Contributor

MrAlias commented Jan 3, 2024

$ go1.20 version
go version go1.20 linux/amd64

$ go1.20 test -run='^$' -bench=NewSetWithSortableFiltered
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/attribute
cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
BenchmarkNewSetWithSortableFiltered-8   	 2496835	       480.1 ns/op	     584 B/op	       4 allocs/op
PASS

On main:

$ go1.20 test -run='^$' -bench=NewSetWithSortableFiltered
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/attribute
cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
BenchmarkNewSetWithSortableFiltered-8   	 4108585	       283.9 ns/op	     448 B/op	       1 allocs/op
PASS

@pellared
Copy link
Member

On branch:

$ go version
go version go1.21.4 linux/amd64

$ go test -run=^$ -bench=NewSetWithSortableFiltered
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/attribute
cpu: Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz
BenchmarkNewSetWithSortableFiltered-16           5002983               239.6 ns/op           448 B/op          1 allocs/op
PASS
ok      go.opentelemetry.io/otel/attribute      1.448s

I think we can consider this PR when we drop support for Go 1.20.

@MrAlias
Copy link
Contributor

MrAlias commented Feb 28, 2024

This should be ready to merge now that #4967 is merged.

Please update to remove the separate code paths for versions of Go less than 1.21 as they are no longer supported.

@ash2k
Copy link
Contributor Author

ash2k commented Mar 6, 2024

goos: darwin
goarch: arm64
pkg: go.opentelemetry.io/otel/attribute
Go: 1.21.8

New code:

BenchmarkFiltering
BenchmarkFiltering/NoFilter
BenchmarkFiltering/NoFilter/Set.Filter
BenchmarkFiltering/NoFilter/Set.Filter-10         	571478235	         2.061 ns/op	       0 B/op	       0 allocs/op
BenchmarkFiltering/NoFilter/NewSetWithFiltered
BenchmarkFiltering/NoFilter/NewSetWithFiltered-10 	 1000000	      1087 ns/op	    3584 B/op	       2 allocs/op
BenchmarkFiltering/NoFiltered
BenchmarkFiltering/NoFiltered/Set.Filter
BenchmarkFiltering/NoFiltered/Set.Filter-10       	 3128260	       382.1 ns/op	       0 B/op	       0 allocs/op
BenchmarkFiltering/NoFiltered/NewSetWithFiltered
BenchmarkFiltering/NoFiltered/NewSetWithFiltered-10         	  967354	      1264 ns/op	    3584 B/op	       2 allocs/op
BenchmarkFiltering/Filtered
BenchmarkFiltering/Filtered/Set.Filter
BenchmarkFiltering/Filtered/Set.Filter-10                   	 1326331	       870.4 ns/op	    1856 B/op	       2 allocs/op
BenchmarkFiltering/Filtered/NewSetWithFiltered
BenchmarkFiltering/Filtered/NewSetWithFiltered-10           	 1217002	       985.0 ns/op	      64 B/op	       1 allocs/op
BenchmarkFiltering/AllDropped
BenchmarkFiltering/AllDropped/Set.Filter
BenchmarkFiltering/AllDropped/Set.Filter-10                 	 1418766	       844.3 ns/op	    1792 B/op	       1 allocs/op
BenchmarkFiltering/AllDropped/NewSetWithFiltered
BenchmarkFiltering/AllDropped/NewSetWithFiltered-10         	 2279227	       525.0 ns/op	       0 B/op	       0 allocs/op

Old code:

BenchmarkFiltering
BenchmarkFiltering/NoFilter
BenchmarkFiltering/NoFilter/Set.Filter
BenchmarkFiltering/NoFilter/Set.Filter-10         	556945123	         2.053 ns/op	       0 B/op	       0 allocs/op
BenchmarkFiltering/NoFilter/NewSetWithFiltered
BenchmarkFiltering/NoFilter/NewSetWithFiltered-10 	 1274888	       943.1 ns/op	    3585 B/op	       2 allocs/op
BenchmarkFiltering/NoFiltered
BenchmarkFiltering/NoFiltered/Set.Filter
BenchmarkFiltering/NoFiltered/Set.Filter-10       	 3141591	       381.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkFiltering/NoFiltered/NewSetWithFiltered
BenchmarkFiltering/NoFiltered/NewSetWithFiltered-10         	 1000000	      1106 ns/op	    3585 B/op	       2 allocs/op
BenchmarkFiltering/Filtered
BenchmarkFiltering/Filtered/Set.Filter
BenchmarkFiltering/Filtered/Set.Filter-10                   	 1377650	       865.5 ns/op	    1856 B/op	       2 allocs/op
BenchmarkFiltering/Filtered/NewSetWithFiltered
BenchmarkFiltering/Filtered/NewSetWithFiltered-10           	 1629787	       733.1 ns/op	      64 B/op	       1 allocs/op
BenchmarkFiltering/AllDropped
BenchmarkFiltering/AllDropped/Set.Filter
BenchmarkFiltering/AllDropped/Set.Filter-10                 	 1416115	       844.3 ns/op	    1792 B/op	       1 allocs/op
BenchmarkFiltering/AllDropped/NewSetWithFiltered
BenchmarkFiltering/AllDropped/NewSetWithFiltered-10         	 3032091	       388.7 ns/op	       0 B/op	       0 allocs/op

Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

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

Can you also please update the PR description as the current one is outdated and may be misleading?

attribute/set.go Outdated Show resolved Hide resolved
@ash2k ash2k changed the title Remove Sortable Deprecate Sortable Mar 6, 2024
CHANGELOG.md Outdated Show resolved Hide resolved
attribute/set.go Outdated Show resolved Hide resolved
attribute/set.go Outdated Show resolved Hide resolved
attribute/set.go Outdated Show resolved Hide resolved
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
attribute/set.go Outdated Show resolved Hide resolved
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Copy link
Contributor

@MrAlias MrAlias left a comment

Choose a reason for hiding this comment

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

Please include the benchmarks from the comments in the PR. There seems to be a lack of tests measuring the performance of NewSet in the existing tetss.

@ash2k
Copy link
Contributor Author

ash2k commented Mar 7, 2024

@MrAlias Added back the benchmark.

Copy link
Contributor

@MrAlias MrAlias left a comment

Choose a reason for hiding this comment

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

@open-telemetry/go-approvers please take a look

@MrAlias MrAlias merged commit 1fe2f03 into open-telemetry:main Mar 11, 2024
24 of 25 checks passed
@ash2k ash2k deleted the remove-sortable branch March 12, 2024 06:59
q-cheng pushed a commit to q-cheng/opentelemetry-go that referenced this pull request Mar 12, 2024
* Deprecate Sortable

* Remove redundant checks

* Move code to a non-deprecated func

* Apply suggestions from code review

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Mention individual deprecated function

* Update attribute/set.go

Co-authored-by: Robert Pająk <pellared@hotmail.com>

* Add BenchmarkNewSet

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
@MrAlias MrAlias added this to the v1.25.0 milestone Apr 3, 2024
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.

4 participants