Precompile statements files vs Precompile excecution files

On the VSCode page on sysimages, one can find the following example content of ./.vscode/JuliaSysimage.toml

exclude=[]   # Additional packages to be exlucded in the system image
statements_files=[]  # Precompile statements files to be used, relative to the project folder
execution_files=[] # Precompile execution files to be used, relative to the project folder

I am wondering - what is the difference between “Precompile statements files” and “Precompile execution files”?

And just to be sure - relative to the project folder - does that mean relative to the Manifest.toml and Project.toml files of the enviroment?

An example of a precompile statements could look like

precompile(Tuple{typeof(Base.sin), Float64})

which tells the compiler to compile the sin function when it is applied to one argument of Float64 type.

AFAIU, the VS code “precompile statements file” is a file containing a list of such precompile statements. You can obtain such a file by running julia with the --trace-compile switch:

shell> julia --trace-compile=/tmp/statements_file.jl
julia> sin(3.0)
julia> exit()

shell> cat /tmp/statements_file.jl 
precompile(Tuple{typeof(Base.sin), Float64})
precompile(Tuple{typeof(, Base.IOContext{Base.TTY}, Base.Multimedia.MIME{Symbol("text/plain")}, Float64})

Automating this one step further, you can provide a simple julia script (which would contain the call to sin(3) in my example), so that executing this script would make julia compile everything that you need. IIUC, this is what VS code would call a “precompile execution file”.

Yes, I think so. I’m actually not sure whether “project” here refers to the Pkg definition, or to what VS code considers a project, but I don’t think it matters in practice because these two typically refer to the same directory on the filesystem. In other words, the .vscode directory and the Project.toml & Manifest.toml files are typically all located under the same “project root directory”:

├── Manifest.toml
├── Project.toml
├── src
│   └── Foo.jl
├── test
│   └── runtests.jl
└── .vscode
    └── JuliaSysimage.jl