Compiling a project specific sysimage

I am getting started with Julia and having a good time. One thing I dislike quite a bit though is the slow startup time of a REPL when you import some costly packages in the beginning. As far as I can tell the best way to work around this is to compile a custom sysimage with PackageCompiler.jl which I did. It works great for some packages like Plots.jl but others refuse to be precompiled and if you try, the sysimage segfaults on load. Instead of fixing the root cause, I decided to write a script that still allows me to precompile as many things as possible anyway.
https://gist.github.com/cqql/d4ab84617a8e532dc0cedcd5469fb715
It lists a project’s dependencies and then compiles them one by one incrementally into a sysimage, checking at each step if the image still loads.

Is there a better/established way to go about this that I missed? As I am still learning the language, is there code in the script that could be written more idiomatically?

1 Like

Note that all parts of this are getting better in 1.6. Startup times are noticeably faster, and precompilation works better.

3 Likes

I read the blog post on invalidations and can’t wait for the release of 1.6! Do you think custom sysimages will still be useful or required?