You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pulls code from FromBytes and UnmarshalBinary into FromBytesOrNil
which reduces the cost of creating a UUID from a byte slice. It also
removes an allocation when the UUID is invalid as it no longer generates
an error which is discarded. One downside of this approach is that it
duplicates the logic from UnmarshalBinary.
```
goos: linux
goarch: amd64
pkg: github.com/gofrs/uuid/v5
cpu: AMD Ryzen 9 5950X 16-Core Processor
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
FromBytesOrNil/valid-32 3.814n ± 0% 1.118n ± 1% -70.69% (n=100)
FromBytesOrNil/empty-32 135.3500n ± 0% 0.6514n ± 1% -99.52% (n=100)
geomean 22.72n 0.8534n -96.24%
│ old.txt │ new.txt │
│ B/op │ B/op vs base │
FromBytesOrNil/valid-32 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=100) ¹
FromBytesOrNil/empty-32 96.00 ± 0% 0.00 ± 0% -100.00% (n=100)
│ old.txt │ new.txt │
│ allocs/op │ allocs/op vs base │
FromBytesOrNil/valid-32 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=100) ¹
FromBytesOrNil/empty-32 2.000 ± 0% 0.000 ± 0% -100.00% (n=100)
```
0 commit comments