Fabrice Vaillant
f3a2d96022
Reduces allocation in attributes ( #5549 )
...
Remove one allocation in all SliceValue function (going from 3 to 2).
Here is benchstat results
```
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/internal/attribute
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
BoolSliceValue-8 128.4n ± 22% 103.8n ± 25% -19.12% (p=0.007 n=10)
Int64SliceValue-8 167.9n ± 7% 130.8n ± 5% -22.13% (p=0.000 n=10)
Float64SliceValue-8 133.8n ± 14% 122.6n ± 4% -8.33% (p=0.000 n=10)
StringSliceValue-8 166.4n ± 9% 158.5n ± 10% -4.75% (p=0.037 n=10)
geomean 148.0n 127.5n -13.88%
│ old.txt │ new.txt │
│ B/op │ B/op vs base │
BoolSliceValue-8 32.000 ± 0% 8.000 ± 0% -75.00% (p=0.000 n=10)
Int64SliceValue-8 88.00 ± 0% 64.00 ± 0% -27.27% (p=0.000 n=10)
Float64SliceValue-8 88.00 ± 0% 64.00 ± 0% -27.27% (p=0.000 n=10)
StringSliceValue-8 152.0 ± 0% 128.0 ± 0% -15.79% (p=0.000 n=10)
geomean 78.34 45.25 -42.23%
│ old.txt │ new.txt │
│ allocs/op │ allocs/op vs base │
BoolSliceValue-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10)
Int64SliceValue-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10)
Float64SliceValue-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10)
StringSliceValue-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10)
geomean 3.000 2.000 -33.33%
```
2024-06-27 10:27:48 -07:00
Robert Pająk
7dea232a46
[chore] Simplify the license header ( #4987 )
2024-02-29 07:05:28 +01:00
Tyler Yahn
5dff273a1e
Use gofumpt instead of gofmt ( #4623 )
...
* Use gofumpt instead of gofmt in golangci-lint conf
* Run gofumpt fixes
* Format generated templates
---------
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
2023-10-16 10:02:21 -07:00
Peter Liu
d68b05fbee
Refactor package internal/attribute
to not use generics. ( #3725 )
...
* remove generics
Signed-off-by: Peter Liu <lpfvip2008@gmail.com>
* Update internal/attribute/attribute.go
Co-authored-by: Damien Mathieu <42@dmathieu.com>
* Update internal/attribute/attribute.go
Co-authored-by: Damien Mathieu <42@dmathieu.com>
* Update internal/attribute/attribute.go
Co-authored-by: Damien Mathieu <42@dmathieu.com>
* Update internal/attribute/attribute.go
Co-authored-by: Damien Mathieu <42@dmathieu.com>
* Update internal/attribute/attribute.go
Co-authored-by: Damien Mathieu <42@dmathieu.com>
* Update internal/attribute/attribute.go
Co-authored-by: Damien Mathieu <42@dmathieu.com>
* Update internal/attribute/attribute.go
Co-authored-by: Damien Mathieu <42@dmathieu.com>
* Update internal/attribute/attribute.go
Co-authored-by: Damien Mathieu <42@dmathieu.com>
* refactor unit test
Signed-off-by: Peter Liu <lpfvip2008@gmail.com>
* add changelog
Signed-off-by: Peter Liu <lpfvip2008@gmail.com>
* update changelog
Signed-off-by: Peter Liu <lpfvip2008@gmail.com>
* Update internal/attribute/attribute.go
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* replace interface{} with any
Signed-off-by: Peter Liu <lpfvip2008@gmail.com>
---------
Signed-off-by: Peter Liu <lpfvip2008@gmail.com>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2023-02-15 10:37:07 -08:00