I have a package Foo
installed as develop (] develop /path/to/Foo
) which I use in my Julia scripts and Pluto notebooks.
Each experiment begins with
using Revise # if a Pluto notebook or REPL
using Foo
As Foo
is a reasonable size it takes around 2 minutes to pre-compile, even though it doesn’t always change between experiments, and when it does its normally minor changes. Is there a way I can store the pre-compiled version, load it in, and then check for any changes using Revise.jl
to make the load times more similar to the (uncompiled) python setup.py develop
? Or is there an alternative methodology to reduce this two-minute bottleneck at the start of all my scripts.
Thanks for clarifying in the comments. My understanding is that what you are asking for is not possible, as compiled code is not cached between Julia sessions. This has been a longstanding issue which is on the core developer's radar but open at the time of writing.
Here is a video from last year's Julia where Jeff includes code caching in the list of to-do things for the compiler team.
More directly addressing your question, here's one of the related issues tracking this, in the discussion you'll also see Tim Holy, Revise's author, more or less directly answering your question.
Relatedly and not really answering your question, from an efficient workflow perspective it's really key to try and minimize the number of times you have to restart your Julia session. That's one of the key use cases of Revise, as it allows you to change things on-the-fly without restarts. The main limitation is struct
definitions, but that can generally be worked around by either working with NamedTuples
or using a "rename-and-replace" strategy, i.e. starting with MyStruct1
and when you want to change it do a find-replace MyStruct1 => MyStruct2
.