Launch speed

Hi, I have a question related to Julia launch speed. I have succesfully created a simple module manipulating process data using DataFrames. I made a package. My package now seems to sit in ~.julia\compiled\v1.6<package-name>. There are some *.ji files. When I start Julia and wait for the REPL prompt, then the first call to the module takes about 15 seconds. The next are very fast. Is there any way how to reduce the first time? Normally, it would not be a problem with interactive use. However, I am trying to call the package from C++ using "jl_init: and “jl_call”, which takes the same 15 seconds. Are there any recommendations how to do such things effeciently? Any recomendations are welcome.

Yes, this talk seems to be exactly for you:

Otherwise, the go-to advice/package:

There are lots of other tricks you could do (with or) without that (first) package. I would first check some of those, there was a recent thread about them on discourse. One of the main tricks for Julia speedup is type-stable code (and I learned it also helps with startup).

I wouldn’t use Julia 1.6, the LTS, I would use the latest version, which is now 1.7.2. I’m not sure that alone helps, but I would at least try to rule out as a possibility. In fact I would go further and since Julia 1.9-DEV nightly is around the corner, I would try that or Julia 1.8 (which is expecting beta1 soon). At least that’s my hope that more recent versions do not need the tricks, so I don’t need to explain them…

What I always try is to run with:

$ ~/julia-1.7.2/bin/julia -O0

or even:

$ ~/julia-1.7.2/bin/julia -O0 --compile=min

The latter is usually the quickest for startup (giving some indication, regarding other tricks), but then slower at runtime.

I think PackageCompiler.jl is likely the route you want to go, it will almost eliminate the startup overhead provided that you ensure that the system image you create contains compiled code for the functions you intend to call.