Question about `PackageCompiler.create_sysimage` parameters

In particular, I want to understand what’s the difference between

  • precompile_execution_file::Union{String, Vector{String}}: A file or list of files that contain code which precompilation statements should be recorded from.
  • precompile_statements_file::Union{String, Vector{String}}: A file or list of files that contains precompilation statements that should be included in the sysimage.

precompile_execution_file should be recorded from?

precompile_statements_file should be included in the sysimage? What’s the difference here?

So with precompile_execution_file, the statements contained within will be traced and compiled, e.g. if I put plot(1:3) in there then once the images are successfully compiled, then running plot(1:3) will be fast.

So what’s the precompile_statements_file? What does it mean to include them?

1 Like

@kristoffer.carlsson ^

See https://juliacomputing.github.io/PackageCompilerX.jl/dev/examples/ohmyrepl.html for an example. It is useful when you want to record things from interactive usage.

2 Likes

The page has references to statements and execution files. I am still not sure how they are different.

Execution file is julia code that runs. For example

call_function("foo")

A statement file is a list of functions and argument types to precompile:

precompile(Tuple{typeof(Mod.call_function), String})

You can use --trace-compile=file.jl to make a statement file (file.jl). That can be passed as the precompile_statements_file argument.

5 Likes