You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-23 22:34:47 +02:00
Good day,
This PR changes As[Bool|Int64|Float64|String]Slice to use a little less
reflection.
The benchstat result of this is as follows.
```
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/internal/attribute
cpu: AMD Ryzen 7 Pro 7735U with Radeon Graphics
│ org.txt │ new.txt │
│ sec/op │ sec/op vs base │
AsFloat64Slice-16 373.3n ± 41% 181.0n ± 42% -51.51% (p=0.000 n=10)
│ org.txt │ new.txt │
│ B/op │ B/op vs base │
AsFloat64Slice-16 64.00 ± 0% 40.00 ± 0% -37.50% (p=0.000 n=10)
│ org.txt │ new.txt │
│ allocs/op │ allocs/op vs base │
AsFloat64Slice-16 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10)
```
---------
Co-authored-by: Damien Mathieu <42@dmathieu.com>