Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid allocations on parseUUID #10

Closed
vtolstov opened this issue Dec 18, 2024 · 2 comments
Closed

avoid allocations on parseUUID #10

vtolstov opened this issue Dec 18, 2024 · 2 comments
Assignees
Labels
enhancement Improvements to existing feature or configuration

Comments

@vtolstov
Copy link

What you think to rewrite parseUUID to avoid allocations if used uuid with "-" ?

func parseUUID(uuid string) ([]byte, error) {
	uuid = strings.ReplaceAll(uuid, "-", "")
	if len(uuid) != 32 {
		return nil, errors.New("invalid UUID length")
	}

	return hex.DecodeString(uuid)
}
@ashwingopalsamy
Copy link
Contributor

Hey, @vtolstov . Appreciate you taking the time to suggest this improvement. It makes the library better for everyone.

Sorry, it took a while for me to respond, as I was out on vacation. This (#12) should probably address your recommendation. Please review.

@ashwingopalsamy ashwingopalsamy added the enhancement Improvements to existing feature or configuration label Dec 26, 2024
@ashwingopalsamy ashwingopalsamy self-assigned this Dec 26, 2024
@vtolstov
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to existing feature or configuration
Projects
None yet
Development

No branches or pull requests

2 participants