There are several cases:
- You are doing interactive exploration. Solution: use an interactive environment (the REPL, a Jupyter notebook, vsCode, Pluto, …) in which you leave Julia running. (For larger-scale code development, do this in conjunction with Revise.jl by creating a package. See Best practise: organising code in Julia - #2 by stevengj)
- Your function
main()
is extremely fast, but you are calling it lots of times. Solution: write your loop in Julia — don’t write a shell script or something. (If you are doing benchmarking, use BenchmarkTools.jl.) - Your function
main()
takes a long time (minutes, hours, …). Solution: use separate Julia runs if you want. The compile time will be irrelevant.