Hi there, I am testing PrecompileTools, and I just don’t get it to work - despite precompilation seems to work (check by MethodAnalysis.methodinstances), julia just recompiles again and again und process restart…
module testprecompile
import PrecompileTools
# EDIT: added @recompile_invalidations
PrecompileTools.@recompile_invalidations using Plots
function main()
plot(rand(10))
savefig("julia_output.png")
end
PrecompileTools.@compile_workload main()
end
Put this into its own package testprecompile
, add the dependencies and take a look whether precompilation worked. E.g. using @time
julia> import testprecompile # I already precompiled it beforehand
testprecompile
julia> @time testprecompile.main() # shows that compilation is just done again
2.470182 seconds (39.70 k allocations: 2.208 MiB, 68.15% compilation time)
"/home/user/Tmp/tmp-julia/testprecompile/julia_output.png"
Apparently it does not work.
Also if I check it via command line --trace-compile=mytrace.jl
, I also see all the precompile statements, despite they should already be precompiled.
How can I get this to work so that precompilation is actually effective?
running Julia 1.9.4