1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-23 22:34:47 +02:00
Files
opentelemetry-go/sdk
Robert Pająk 0cc2eb946f sdk/log: BenchmarkAddAttributes, BenchmarkSetAttributes, BenchmarkSetBody (#7387)
Towards https://github.com/open-telemetry/opentelemetry-go/issues/7364

This will help making sure that the fix for
https://github.com/open-telemetry/opentelemetry-go/issues/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
```
2025-09-23 14:42:58 +02:00
..
2024-03-26 20:13:54 +01:00
2025-08-29 12:42:52 -07:00

SDK

PkgGoDev