1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-10-08 23:21:56 +02:00
Files
opentelemetry-go/sdk
Robert Pająk 078a4a844f sdk/log: Assign fltrProcessors on provider creation instead of lazy (#6239)
I think it is better to calculate fltrProcessors upfront instead of
doing it in a lazy manner. Reasons:

- No locks/synchronization in the hot-path. Even though the performance
overhead is not big (in practice it will be usually unnoticeable, in my
benchmark execution it is less than a nanosecond) I think it is good to
minimize locking on the hot path.
- Simpler code (subjective, but at least less code by 9 lines)

```
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/log
cpu: 13th Gen Intel(R) Core(TM) i7-13800H
                 │   old.txt   │               new.txt               │
                 │   sec/op    │   sec/op     vs base                │
LoggerEnabled-20   6.010n ± 1%   5.364n ± 1%  -10.73% (p=0.000 n=10)

                 │  old.txt   │            new.txt             │
                 │    B/op    │    B/op     vs base            │
LoggerEnabled-20   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal

                 │  old.txt   │            new.txt             │
                 │ allocs/op  │ allocs/op   vs base            │
LoggerEnabled-20   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal
```
2025-02-04 14:38:10 +01:00
..
2025-01-17 08:21:54 -08:00
2025-01-05 09:26:07 -08:00
2024-03-26 20:13:54 +01:00

SDK

PkgGoDev