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

log: Add benchmark tests #4958

Merged
merged 6 commits into from Feb 22, 2024
Merged

log: Add benchmark tests #4958

merged 6 commits into from Feb 22, 2024

Conversation

MrAlias
Copy link
Contributor

@MrAlias MrAlias commented Feb 21, 2024

Resolve #4915

$ benchstat old.txt
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/log
cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
                           │    old.txt    │
                           │    sec/op     │
Bool/Value-8                 0.8047n ±  2%
Bool/KeyValue-8               6.367n ±  0%
Bool/AsBool-8                 2.900n ±  2%
Bool/AsAny-8                  3.777n ±  3%
Float64/Value-8              0.8654n ±  3%
Float64/KeyValue-8            6.362n ±  0%
Float64/AsFloat64-8           2.939n ±  5%
Float64/AsAny-8               17.30n ±  7%
Int/Value-8                  0.8589n ±  1%
Int/KeyValue-8                6.370n ±  0%
Int/AsInt64-8                 3.028n ±  3%
Int/AsAny-8                   5.168n ±  1%
Int64/Value-8                0.8743n ±  3%
Int64/KeyValue-8              6.367n ±  0%
Int64/AsInt64-8               2.972n ±  4%
Int64/AsAny-8                 5.244n ±  3%
Map/Value-8                  0.8623n ±  5%
Map/KeyValue-8                6.361n ±  0%
Map/AsMap-8                   3.560n ±  3%
Map/AsAny-8                   41.89n ±  9%
Slice/Value-8                0.8771n ±  3%
Slice/KeyValue-8              6.359n ±  0%
Slice/AsSlice-8               3.587n ±  3%
Slice/AsAny-8                 43.53n ± 18%
String/Value-8               0.8803n ±  3%
String/KeyValue-8             6.358n ±  0%
String/AsString-8             3.053n ±  3%
String/AsAny-8                35.76n ±  9%
Record/Timestamp-8           0.9086n ±  2%
Record/ObservedTimestamp-8   0.9074n ±  4%
Record/Severity-8            0.2752n ±  2%
Record/SeverityText-8        0.8861n ±  3%
Record/Body-8                0.8524n ±  5%
Record/Attributes/5-8         70.75n ±  3%
Record/Attributes/10-8        317.1n ± 16%
geomean                       3.800n

                           │   old.txt    │
                           │     B/op     │
Bool/Value-8                 0.000 ± 0%
Bool/KeyValue-8              0.000 ± 0%
Bool/AsBool-8                0.000 ± 0%
Bool/AsAny-8                 0.000 ± 0%
Float64/Value-8              0.000 ± 0%
Float64/KeyValue-8           0.000 ± 0%
Float64/AsFloat64-8          0.000 ± 0%
Float64/AsAny-8              8.000 ± 0%
Int/Value-8                  0.000 ± 0%
Int/KeyValue-8               0.000 ± 0%
Int/AsInt64-8                0.000 ± 0%
Int/AsAny-8                  0.000 ± 0%
Int64/Value-8                0.000 ± 0%
Int64/KeyValue-8             0.000 ± 0%
Int64/AsInt64-8              0.000 ± 0%
Int64/AsAny-8                0.000 ± 0%
Map/Value-8                  0.000 ± 0%
Map/KeyValue-8               0.000 ± 0%
Map/AsMap-8                  0.000 ± 0%
Map/AsAny-8                  24.00 ± 0%
Slice/Value-8                0.000 ± 0%
Slice/KeyValue-8             0.000 ± 0%
Slice/AsSlice-8              0.000 ± 0%
Slice/AsAny-8                24.00 ± 0%
String/Value-8               0.000 ± 0%
String/KeyValue-8            0.000 ± 0%
String/AsString-8            0.000 ± 0%
String/AsAny-8               16.00 ± 0%
Record/Timestamp-8           0.000 ± 0%
Record/ObservedTimestamp-8   0.000 ± 0%
Record/Severity-8            0.000 ± 0%
Record/SeverityText-8        0.000 ± 0%
Record/Body-8                0.000 ± 0%
Record/Attributes/5-8        0.000 ± 0%
Record/Attributes/10-8       208.0 ± 0%
geomean                                 ¹
¹ summaries must be >0 to compute geomean

                           │   old.txt    │
                           │  allocs/op   │
Bool/Value-8                 0.000 ± 0%
Bool/KeyValue-8              0.000 ± 0%
Bool/AsBool-8                0.000 ± 0%
Bool/AsAny-8                 0.000 ± 0%
Float64/Value-8              0.000 ± 0%
Float64/KeyValue-8           0.000 ± 0%
Float64/AsFloat64-8          0.000 ± 0%
Float64/AsAny-8              1.000 ± 0%
Int/Value-8                  0.000 ± 0%
Int/KeyValue-8               0.000 ± 0%
Int/AsInt64-8                0.000 ± 0%
Int/AsAny-8                  0.000 ± 0%
Int64/Value-8                0.000 ± 0%
Int64/KeyValue-8             0.000 ± 0%
Int64/AsInt64-8              0.000 ± 0%
Int64/AsAny-8                0.000 ± 0%
Map/Value-8                  0.000 ± 0%
Map/KeyValue-8               0.000 ± 0%
Map/AsMap-8                  0.000 ± 0%
Map/AsAny-8                  1.000 ± 0%
Slice/Value-8                0.000 ± 0%
Slice/KeyValue-8             0.000 ± 0%
Slice/AsSlice-8              0.000 ± 0%
Slice/AsAny-8                1.000 ± 0%
String/Value-8               0.000 ± 0%
String/KeyValue-8            0.000 ± 0%
String/AsString-8            0.000 ± 0%
String/AsAny-8               1.000 ± 0%
Record/Timestamp-8           0.000 ± 0%
Record/ObservedTimestamp-8   0.000 ± 0%
Record/Severity-8            0.000 ± 0%
Record/SeverityText-8        0.000 ± 0%
Record/Body-8                0.000 ± 0%
Record/Attributes/5-8        0.000 ± 0%
Record/Attributes/10-8       1.000 ± 0%
geomean                                 ¹
¹ summaries must be >0 to compute geomean

@MrAlias MrAlias added area:logs Part of OpenTelemetry logs Skip Changelog PRs that do not require a CHANGELOG.md entry labels Feb 21, 2024
Copy link

codecov bot commented Feb 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7b3382e) 82.9% compared to head (8f2d3a7) 82.9%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #4958     +/-   ##
=======================================
- Coverage   82.9%   82.9%   -0.1%     
=======================================
  Files        238     238             
  Lines      19182   19182             
=======================================
- Hits       15905   15903      -2     
- Misses      2985    2987      +2     
  Partials     292     292             

see 1 file with indirect coverage changes

log/record_test.go Outdated Show resolved Hide resolved
Co-authored-by: Sam Xie <sam@samxie.me>
@pellared pellared changed the title Add benchmark tests for Value and KeyValue log: Add benchmark tests Feb 22, 2024
@pellared
Copy link
Member

I edited the title as it also includes benchmarks for Record. I think we do not need more benchmarks than those in this PR.

pellared
pellared previously approved these changes Feb 22, 2024
log/record_test.go Outdated Show resolved Hide resolved
@pellared pellared dismissed their stale review February 22, 2024 08:42

Attributes should be inlined.

log/record_test.go Outdated Show resolved Hide resolved
@pellared pellared merged commit 6ea99af into open-telemetry:main Feb 22, 2024
30 checks passed
@MrAlias MrAlias added this to the v1.24.0 milestone Feb 22, 2024
@MrAlias MrAlias deleted the log-bmark branch February 22, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:logs Part of OpenTelemetry logs Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add benchmarks to log package
5 participants