Do I need to restart the REPL every time before rerunning a Julia script?

Julia’s package loading process can be quite time-consuming, but when debugging code, I often need to run the script multiple times. To clear the previously produced results in the workspace, I employ the practice of restarting the workspace before every rerun. However, this approach results in all the loaded packages in the workspace being cleared. When I rerun the code, all the packages have to be reloaded, which is time-consuming. Is this approach correct, and is there any better way to handle this? (I use VS code)

image

No, you should use “Revise”, and have all your computations inside functions, that can be rerun and tested repeatedly after modification.

Some info about good workflows:

4 Likes

Thank you very much! I will look into this.