I’d like to introduce new package AutoSysimages.jl that aims to automate building process of sysimages. It records precompile statements during normal Julia usage. Then, building a user-specific system image for your project is possible by a single command.
This is intentional that dev packages are not allowed to be included because such packages are not static and you would need to rebuild the sysimage after any change. Thus, it seems reasonable to include only released packages.
No questions should be asked for non-REPL (noninteractive) usage. Thus the following should work (once you create the sysimage). Or you can rename the startup script…
asysimg benchmark.jl
julia benchmark.jl
The only difference for now is that it prints the @info. We can suppress it in non-REPL mode in the future.
It should be sufficient to add AutoSysimages into the global environment. Also, AutoSysimages is automatically included to the sysimage for faster startup, unless AutoSysimages is in dev mode.
To be honest, I do not see ANY effect from using AutoSysimages.
What I did (on Ubuntu):
install AutoSysimages
change folder of my work project
run asysimg --project
run include(“src/plot.jl”) from the asysimage prompt
close the plot window
press <ctrl>+<d>
I get the message:
asysimg>
[ Info: AutoSysimages: Copy snooped statements to: /home/ufechner/.julia/asysimg/1.8.1/23RTv7/snoop-file.jl
[ Info: There is no sysimage for this project. Do you want to build one?
> Yes
No
I press enter and select No for the next question (do you want to select packages).
Now it builds a system image.
[ Info: AutoSysimages: Copy snooped statements to: /home/ufechner/.julia/asysimg/1.8.1/23ZRuw/snoop-file.jl
[ Info: There is no sysimage for this project. Do you want to build one?
> Yes
No
[ Info: AutoSysimages: Collecting precompile statements for empty run (-e "")
[ Info: AutoSysimages: Building system image by PackageCompiler.
⠇ [00m:10s] PackageCompiler: compiling incremental system image┌ Warning: There is no statement file
└ @ Main.anonymous /home/ufechner/.julia/packages/AutoSysimages/LTaGS/src/precompile-PackageCompiler.jl:44
✔ [02m:25s] PackageCompiler: compiling incremental system image
[ Info: AutoSysimages: Builded in 147.87036108970642 s
If I now launch julia again and run the same include statement the time to first plot is 17s as before:
ufechner@TUD277255:~/repos/Plotting$ asysimg --project
┌ Info: The package AutoSysimages.jl started!
│ Loaded sysimage: Default (You may run AutoSysimages.build_sysimage())
│ Active directory: /home/ufechner/.julia/asysimg/1.8.1/23ZRuw
│ Global snoop file: /home/ufechner/.julia/asysimg/1.8.1/23ZRuw/snoop-file.jl
└ Tmp. snoop file: /tmp/jl_gJmh8ds5yB-snoop.jl
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.8.1 (2022-09-06)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
asysimg> @time include("src/plot.jl")
To zoom, draw a rectangle while keeping the right mouse key pressed!
To go back to see the full graph, press <CRTRL><f>
17.618484 seconds (43.41 M allocations: 2.397 GiB, 4.78% gc time, 71.93% compilation time: 12% of which was recompilation)
It determines the active directory /home/ufechner/.julia/asysimg/1.8.1/23ZRuw correctly, but the sysimage is not loaded (see, Loaded sysimage: Default). I’ll look at it, and moved the discussion to Unable to save/load sysimage · Issue #5 · petvana/AutoSysimages.jl · GitHub. Thank you for the detailed report.
But that means a developer cannot test to compile its own package. And all developers have more than one Julia version installed, so he/she could develop in one version and try/use it in another.