I have a simple package Test1
:
module Test1
f1(x) = x + 1
f2(x) = f1(2x)
f3(x) = f1(3x)
using PrecompileTools
@compile_workload begin
f2(1.2)
end
end # module
I load and precompile the package in an environment. I then run:
julia --trace-compile stderr -e 'using Test1; Test1.f2(1.2); Test1.f1(1.2);'
I get the output:
:
precompile(Tuple{typeof(Test1.f2), Float64})
precompile(Tuple{typeof(Test1.f1), Float64})
Two questions:
- I would have expected the method
Test1.f2(::Float64)
to have been cached at precompilation. Why do I get aprecompile(...)
statement forTest1.f2
in the trace when I run this? - I would have expected the method
Test1.f1(::Float64)
to have been compiled when I runf2(1.2)
, so why do I get aprecompile(...)
statement in the trace forTest1.f1
when I run theTest1.f1(1.2)
statement?
If I add an explicit precompile(f2, (Float64,))
to Test1
, the precompile statment for f2
is no longer shown on execution, as one would expect. But the one for f1
still appears, although f1
should have been precompiled due to precompilation of f2
.