Suppose that I launch Julia through bash script:
for i in {1..10}; do for j in 0.1 0.5 1 2 5 10; do j7 src/some_script.jl $i $j; done ; done
Currently, I am doing the following within some_script.jl
so the compilation time gets faster:
# some_script.jl
main(i, j)
some_fct(time_limit=20, i, j) # time_limit is 20s
some_fct(time_limit=3600, i, j) # time limit is one hour
end
main(parse(Int, ARGS[1]), parse(Int, ARGS[2]))
Am I right doing so? Will the second execution of some_fct
be faster thanks to the first launch?
EDIT: As a clarification to Ashlin Harris' answer. It is normal that my for loop is not precompilied as I want every launch to be independant. However, for a given i
, and j
, I would like that my script takes advantage of on-time precompilation. That is why I launch my function twice, hoping that its second launch will be faster. At end, I am wondering myself, whether this:
# some_script.jl
main(i, j)
some_fct(time_limit=20, i, j) # time_limit is 20s
some_fct(time_limit=3600, i, j) # time limit is one hour
end
main(1,2)
Is better for some_fct than this:
# some_script.jl
main(i, j)
some_fct(time_limit=3600, i, j) # time limit is one hour
end
main(1,2)
?