Skip to content

sdk/log: BenchmarkAddAttributes, BenchmarkSetAttributes, BenchmarkSetBody#7387

Merged
dmathieu merged 2 commits intoopen-telemetry:mainfrom
pellared:bench-7364
Sep 23, 2025
Merged

sdk/log: BenchmarkAddAttributes, BenchmarkSetAttributes, BenchmarkSetBody#7387
dmathieu merged 2 commits intoopen-telemetry:mainfrom
pellared:bench-7364

Conversation

@pellared
Copy link
Copy Markdown
Member

@pellared pellared commented Sep 19, 2025

Towards #7364

This will help making sure that the fix for #7364 is not adding unnecessary overhead when limits do not cause dropping and deduplication is not happening.

$ go test -bench="AddAttributes|SetAttributes|SetBody" -run=^$ -benchtime=100ms
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/log
cpu: 13th Gen Intel(R) Core(TM) i7-13800H
BenchmarkAddAttributes/Single/NoLimits-20         	 2025201	        59.20 ns/op	       0 B/op	       0 allocs/op
BenchmarkAddAttributes/Single/AllowDuplicates-20  	 4987790	        24.05 ns/op	       0 B/op	       0 allocs/op
BenchmarkAddAttributes/Unique/NoLimits-20         	  672564	       183.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkAddAttributes/Unique/AllowDuplicates-20  	 1736347	        68.13 ns/op	       0 B/op	       0 allocs/op
BenchmarkAddAttributes/Deduplication/Enabled-20   	  865591	       135.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkAddAttributes/NestedDeduplication/Enabled-20         	  275410	       431.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkAddAttributes/NestedDeduplication/Disabled-20        	  713812	       162.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkAddAttributes/Deduplication/Disabled-20              	 1775750	        67.73 ns/op	       0 B/op	       0 allocs/op
BenchmarkAddAttributes/CountLimit/Hit-20                      	  210417	       552.0 ns/op	     208 B/op	       1 allocs/op
BenchmarkAddAttributes/CountLimit/NotHit-20                   	  141958	       892.2 ns/op	     640 B/op	       1 allocs/op
BenchmarkAddAttributes/ValueLimit/Hit-20                      	  885476	       133.7 ns/op	       0 B/op	       0 allocs/op
BenchmarkAddAttributes/ValueLimit/NotHit-20                   	  924368	       115.2 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetAttributes/Single/NoLimits-20                     	 2024268	        59.23 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetAttributes/Single/AllowDuplicates-20              	 4996321	        24.14 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetAttributes/Unique/NoLimits-20                     	  609895	       186.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetAttributes/Unique/AllowDuplicates-20              	 1393672	        86.26 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetAttributes/Deduplication/Enabled-20               	  803832	       147.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetAttributes/Deduplication/Disabled-20              	 1607533	        73.55 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetAttributes/NestedDeduplication/Enabled-20         	  225752	       444.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetAttributes/NestedDeduplication/Disabled-20        	  696045	       175.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetAttributes/CountLimit/Hit-20                      	  202834	       632.3 ns/op	     208 B/op	       1 allocs/op
BenchmarkSetAttributes/CountLimit/NotHit-20                   	  149197	       793.4 ns/op	     640 B/op	       1 allocs/op
BenchmarkSetAttributes/ValueLimit/Hit-20                      	  894547	       134.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetAttributes/ValueLimit/NotHit-20                   	 1000000	       117.0 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetAttributes/Overwrite/Existing-20                  	  648174	       173.6 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetBody/Simple/NoLimits-20                           	 9593739	        14.12 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetBody/Simple/WithLimits-20                         	 9397982	        13.85 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetBody/UniqueMap/NoLimits-20                        	  525252	       207.4 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetBody/UniqueMap/AllowDuplicates-20                 	10077223	        13.16 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetBody/Deduplication/Enabled-20                     	 1063749	       108.9 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetBody/Deduplication/Disabled-20                    	 9973114	        13.01 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetBody/NestedDeduplication/Enabled-20               	  581662	       198.7 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetBody/NestedDeduplication/Disabled-20              	10068196	        13.15 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetBody/ValueLimit/Hit-20                            	 1292136	        92.08 ns/op	       0 B/op	       0 allocs/op
BenchmarkSetBody/ValueLimit/NoHit-20                          	 1414297	        92.29 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	go.opentelemetry.io/otel/sdk/log	12.145s

@pellared pellared added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Sep 19, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.5%. Comparing base (80cb909) to head (405b3c0).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #7387   +/-   ##
=====================================
  Coverage   85.5%   85.5%           
=====================================
  Files        275     275           
  Lines      24614   24614           
=====================================
  Hits       21047   21047           
  Misses      3188    3188           
  Partials     379     379           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pellared pellared marked this pull request as ready for review September 19, 2025 13:17
@dmathieu dmathieu merged commit 0cc2eb9 into open-telemetry:main Sep 23, 2025
47 of 52 checks passed
@MrAlias MrAlias added this to the v1.39.0 milestone Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants