-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Description
There should be a command line parameter called --append-precompiles or --save-compile or something like this which enables to save all precompiles which happened during runtime (either in parallel at runtime or when the program finishes). The precompiles should probably be saved in the module image where the precompile was triggered from (the caller of the function).
This way, the precompilation image file contains both the precompiles from the precompile pass and the precompiles which came up during runtime (possibly the result of multiple runs (as the union set operation) if new calls come up in different runs). If the module is changed, all precompiles would get invalidated as usual. Afterwards, the number of precompiles grows first with the first precompile run and then possibly with each run (although most modules will not grow anymore at all after precompilation or only for the first run).
I am not sure how the REPL comes into place for this features. Until there are good ideas it might be best to not have this feature (saving new precompiles) in an interactive session.
With this mechanism in place I could even imagine that the regular precompile run might not even be intended for a lot of use cases. Just run the code and whenever some method is called the first time, precompile it, save the precompilation and go on. That means after a code change the functions are precompiled iff they are actually used, i.e. no currently unused function is precompiled and no function is precompiled more than once (even when accounting for multiple program runs; as long as the involved code is not modified).