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

Try initializing namespaces lazily #258

Merged
merged 1 commit into from
Sep 4, 2019

Conversation

jcburley
Copy link
Contributor

@jcburley jcburley commented Sep 3, 2019

This is something of a proof of concept, as it doesn't seem to speed up official Joker much that I can measure on the two machines I'm using while on vacation (and my main development machine, at home, is even less likely to show much of a difference).

But, applied to my gostd fork, the resulting Joker definitely starts up faster, though still not as quickly as official Joker. (I think there's room for further improvement, in terms of delaying var-time initialization until Init() is called. That might help things further.)

That suggests this PR, or something like it, could keep Joker startup times from getting much longer even if/as more namespaces and/or functions (vars) are added to its default library.

Note that, while trying different ideas out, I was disappointed to discover that Go currently does not offer much in the way of practical build-time initialization, beyond scalar constants. That is, arrays and maps, in particular, cannot be initialized at build time and thus be present, already-initialized, when the resulting executable starts up. I hope to see improvements in this situation someday soon, and might look into how feasible it is to do and possibly offer to help with them.

@jcburley jcburley mentioned this pull request Sep 3, 2019
@candid82
Copy link
Owner

candid82 commented Sep 4, 2019

This is a pretty neat trick. Thanks!

@candid82 candid82 merged commit 94f7fbb into candid82:master Sep 4, 2019
@jcburley jcburley deleted the lazy-namespaces branch September 10, 2019 15:38
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