Tags: gofrs/uuid
Tags
Improve performance of FromBytesOrNil (#206) 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) ```
Add "AtTime" generators for V1, V6, and V7 (#142) * add "AtTime" generators for V1, V6, and V7 * doc: update doc strings * fix: convenience methods * test: add tests for AtTime methods --------- Co-authored-by: Cameron Ackerman <cameron_ackerman@selinc.com>
Enhance defaultHWAddrFunc() and tests to hit 100% coverage (#57) This updates `defaultHWAddrFunc` to use a package-level variable for calling `net.Interfaces()`, so that we can mock it in unit tests. Doing so, and writing the related test, allows us to hit 100% coverage. Signed-off-by: Tim Heckman <t@heckman.io> Signed-off-by: Tim Heckman <t@heckman.io> Co-authored-by: Cameron Ackerman <Cameron_Ackerman@selinc.com>
PreviousNext