You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-10-08 23:21:56 +02:00
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 ```