I am relatively new in Julia, so maybe I am missing something trivial.
I created a file containing a function, using the Symbolics package
_, f = build_function(F, x)
write("function.jl", string(f))
myf = include("function.jl")
where F is a symbolic polynomial vector-valued function, and x is a symbolic vector.
When I try to call myf for the first time, Julia takes a lot of time (up to 1h) to give a result. On the other hand, from the second call on, myf only takes some nanoseconds. The same gigantic runtime is needed if I use precompile. So, I think it is the compiler requiring a lot of time to compile myf.
Do you have any clue why this happens? And, in case, how can I mitigate it?
PS: Below, you can find a bit of function.jl, to give an idea of what is inside it
function (ˍ₋out, ˍ₋arg1)
begin
begin
@inbounds begin
ˍ₋out[1] = 1.0
[...]
ˍ₋out[48] = ˍ₋arg1[47]
ˍ₋out[49] = (+)(-0.7071067811865475, (*)(0.7071067811865475, (^)(ˍ₋arg1[1], 2)))
ˍ₋out[50] = (*)(ˍ₋arg1[1], ˍ₋arg1[2])
ˍ₋out[51] = (*)(ˍ₋arg1[1], ˍ₋arg1[3])
[...]
ˍ₋out[74308] = (*)((*)((*)(ˍ₋arg1[36], ˍ₋arg1[4]), ˍ₋arg1[47]), ˍ₋arg1[6])
ˍ₋out[74309] = (*)((*)((+)(-0.7071067811865475, (*)(0.7071067811865475, (^)(ˍ₋arg1[37], 2))), ˍ₋arg1[4]), ˍ₋arg1[6])
ˍ₋out[74310] = (*)((*)((*)(ˍ₋arg1[37], ˍ₋arg1[38]), ˍ₋arg1[4]), ˍ₋arg1[6])
[...]
nothing
end
end
end
end