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

Lazily initialize regexes to speed up init() #1246

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kylecarbs
Copy link

Using GODEBUG=inittrace=1 I found a relatively constant 10ms init caused by this function.

@go-playground/validator-maintainers

Using `GODEBUG=inittrace=1` I found a relatively constant
10ms init caused by this function.
@kylecarbs kylecarbs requested a review from a team as a code owner April 1, 2024 20:01
@coveralls
Copy link

coveralls commented Apr 1, 2024

Coverage Status

coverage: 74.228% (+0.02%) from 74.208%
when pulling cebbc77 on kylecarbs:master
into a0f74b0 on go-playground:master.

@kylecarbs kylecarbs changed the title Lazily initialize postcode regexes to speed up init() Lazily initialize regexes to speed up init() Apr 1, 2024
@deankarn
Copy link
Contributor

@kylecarbs out of curiosity, what is your use case where 10ms is not tolerable?

@kylecarbs
Copy link
Author

@deankarn this package is imported in our CLI. Adding that overhead to every invocation (even help) isn't great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants