-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
module init functions #1268
Comments
Much less important than module initialization, but possibly worth including in the thought process here: an optional thunk for forced-precompilation. See https://github.com/timholy/Images.jl/blob/2d51289829a74aeeaa18bd93e3532f6fe32eb5a0/src/Images.jl#L24-L49 I was able to reduce the time to load Images and run the |
So how does that help the load time? Wouldn't it just shift around when the compilation happens? Why is it better to do all the precompilation up front than on demand? |
It doesn't change the load time ( |
Ah, yes, I see. That makes perfect sense. We should definitely support that. |
My straw man proposal here would be to call a function named
|
Under what other circumstances would you have to attach initializers to objects besides module initialization? |
Yeah, we might be better off not over-engineering this and just adding simple module init functions. After all you can use those to set up arbitrary data structures anyway. |
It is common for C libraries to require some init call on startup, like
Tk_Init
. It would be nice to know about modules that need to call such functions, and hook them into julia's_init
in the future when julia code is used as a library.Currently we have 2 overall phases: definition time (when a source file is loaded) and run time. We need to insert "startup time" in between. It takes place right after load time when you first load a file, and also at startup when "compiled" code is loaded.
The text was updated successfully, but these errors were encountered: