Avoid slowness in the first execution of a function

Hello everyone.

I noticed that the first time I run a function with julia, the execution time (as well as the allocated memory) is significantly higher than subsequent executions, at least in my code.

Since I have to run my code on a cluster remotely (i.e. the code in julia starts and runs only once) is there any trick to avoid making execution faster from the start?

Thanks, good day everyone.

not really, this is just how Julia works, JIT

The longer time is due to precompilation. If your code uses packages that need precompilation maybe a custom sys image might help. Of course that needs to be compiled too so only worth it if you have similar workloads multiple times.

or

are the current solutions/workarounds depending on your needs and what you are allowed on the cluster.

1 Like