JIT Performance for Single-Run Scripts

#1

I’m new to Julia (coming from Python), but I like what I see. However, I do have what may be a dumb question. Forgive me if it is.

I have a single file that I want to run from the command line with something like: sh> julia file.jl infile.csv that uses DataFrames to manipulate data and saves it out. It seems that each time the JIT is running and it is painfully slow. I know if I run the code one time then it will compile and be faster on subsequent runs, but in some situations, I don’t want to run my code twice.

What am I missing? I know it must be pretty simple, but I don’t know where to look for guidance.

TJB

0 Likes

#2

My understanding is that there are a few efforts to improve the compile time latency. One is PackageCompiler.jl. You might find some of this discussion about compiler optimizations to be useful. Someone might have more update to date information about these projects.

2 Likes

#3

It’s a downside of the JIT system, which makes Julia not ideal for short command line programs. The main workaround is to change a bit your workflow. Instead of restarting Julia each time, start it once and then do include("file.jl") to run your analysis (or define a function and run it), so you don’t need to reload and recompile things each time.

Otherwise you can try to compile your packages as said above.

2 Likes

#4

Although it may not help you with your current problem, it’s worth mentioning that using Revise is recommended for code development. It allows you to modify code without having to restart your Julia session and compile your packages again. The main limitation is that it does not currently work for structs, but there are plans to eventually incorporate this functionality.

1 Like