Hello. I wrote a set of functions myself (with julia v0.5.0), and wanted to precompile them using precompile, e.g., precompile(myfunc, (Matrix{Float64}, Vector{Int64})), etc. Now, precompile returns true on some of my functions while it returns false on the other functions of mine. All these functions do work properly, but I do not understand why precompile behave differently. First of all, does getting true and false from precompile indicate the success and failure of precompiling it, respectively?
If I dig a bit more, the precompile function is defined in base/essentials.jl as:
function precompile(f::ANY, args::Tuple)
ccall(:jl_compile_hint, Cint, (Any,), Tuple{Core.Typeof(f), args...}) != 0
end
function precompile(argt::Type)
ccall(:jl_compile_hint, Cint, (Any,), argt) != 0
end
But it’s not clear to me how to check more, e.g., how jl_compile_hint works, etc.
Since the julia documentation does not describe this precompile function in detail, I would appreciate your help!
Best regards,
BVPs
@yuyichao, Thank you very much for your reply.
I still haven’t thoroughly studied what the leaftype really is, but those functions that precompile returned false are all involved with parametric types. When I ran precompile on those functions with providing specific parameter values, then they returned true. So, what I have to do is to run precompile by specifying all possible combinations of those parameter values, e.g.,
@yuyichao: thanks a lot for the document page. However, I don’t understand why isleaftype(Vector{Complex}) returns true. Of course, I understand why isleaftype(Vector{Complex{Float32}}) returns true. Could you explain this behavior to me? Thanks!
@yuyichao; @kristoffer.carlsson: thanks for your reply. But I still don’t understand the leaftypes. Why Vector{Complex} is of leaftype while Complex itself is not?