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

Build the embedded word lists lazily #11

Closed
wants to merge 1 commit into from
Closed

Build the embedded word lists lazily #11

wants to merge 1 commit into from

Conversation

espadolini
Copy link

Maps in vars are created at init time, resulting in something like 2.5MiB of allocation at runtime that can be problematic for programs that only optionally use the generator; this PR changes the word lists from a literal map to an explicit function that does the assignment plus a sync.Once. I didn't use sync.OnceValue to keep the minimum Go requirement low.

The changes should be only a handful of lines on each file if you ignore whitespace in the diff view.

@sethvargo
Copy link
Owner

I actually think bumping the Go version and using sync.OnceValue is cleaner and more appropriate here: #12

@sethvargo sethvargo closed this in #12 May 9, 2024
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.

2 participants