An easy way to find out would be to use the --trace-compile
argument to julia to write all the precompile statements to a file when you load Example
.
Here’s how I did that:
The setup:
❯ tree Example
Example
├── Project.toml
└── src
└── Example.jl
2 directories, 2 files
❯ cat Example/src/Example.jl
module Example
export hello, domath
"""
hello(who::String)
Return "Hello, `who`".
"""
hello(who::String) = "Hello, $who"
"""
domath(x::Number)
Return `x + 5`.
"""
domath(x::Number) = x + 5
end
Now run julia with --trace-compile
in the Example
project, and load Example
:
❯ julia --startup=no --trace-compile=precompile.jl --project=Example -e "using Example"
Now lets look at the contents of precompile.jl
:
❯ cat precompile.jl
precompile(Tuple{FileWatching.Pidfile.var"##mkpidlock#7", Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol}, NamedTuple{(:stale_age, :wait), Tuple{Int64, Bool}}}, typeof(FileWatching.Pidfile.mkpidlock), Base.var"#1080#1081"{Base.PkgId}, String, Int32})
precompile(Tuple{typeof(Core.kwcall), NamedTuple{(:reasons,), Tuple{Base.Dict{String, Int64}}}, typeof(Base.compilecache), Base.PkgId, String})
precompile(Tuple{typeof(Base.arg_gen), Tuple{String, String}})
precompile(Tuple{typeof(Base.write), Base.IOStream, UInt32})
Looks like it’s nothing to do with Example
, so that tells me nothing is being precompiled here.
I’m a little surprised, since it seems like it’d be a low-hanging fruit to at least precompile the methods with concrete signatures (i.e. hello(::String)
.