JuliaLang / PackageCompiler.jl

Compile your Julia Package
https://julialang.github.io/PackageCompiler.jl/dev/
MIT License
1.41k stars 189 forks source link

Cache non-incremental base system image to reduce cycle times #841

Open sloede opened 1 year ago

sloede commented 1 year ago

Would it be possible to cache the non-incremental base system image created first when using incremental=false? On my machine, this step alone takes usually between 2 and 3 minutes (see #839), making the development cycle with PC.jl painfully slow.

I see at least two variants how this could be achieved: 1) Allow the user to control this manually by providing a base_sysimage_cache argument to create_sysimage (and create_library, create_app). By default it is nothing, but if set, an existing cache file will be read in and/or written out to the given locations. This requires the user to figure out when it is OK to reuse the base image and when it is not. 2) Enable automatic caching by providing a base_sysimage_cache argument to create_sysimage. It should be the path to a folder where create_sysimage will store the base sysimage plus information it needs to determine whether it is safe to reuse the image or not (e.g., by verifying the arguments to create_fresh_sysimage are identical, plus relevant Julia command line args that affect compilation).

To me, the first variant seems not too hard to implemented, and it could be later augmented to the second variant (and/or an automatic cache management using Scratch.jl managed storage).