Go package for UUIDs based on RFC 4122 and DCE 1.1: Authentication and Security Services.
BSD 3-Clause "New" or "Revised" License
5.16k
stars
362
forks
source link
fix: Use .EqualFold() to parse urn prefixed UUIDs #118
Closed
ayang64 closed 11 months ago
Prior to this commit we used a comparison with the result of ToLower() to test for a "urn:uuid" prefix in both UUID strings and byte slices.
This commit replaces the ToLower and string comparison with both strings.EqualFold and bytes.EqualFold.
This reduces the CPU time across the board for UUIDs that start with "urn:uuid" and eliminates some allocations when parsing bytes.
The benchmark output was generated by adding "urn:uuid" to the test input.