You took out my context “For scripts”, for me, implying short-running code [EDIT: FYI: I’ve seen --compile=min be 3.7x faster, than Julia’s defaults, on a 30 sec, 12-line (excl. dependencies) script: Faster startup by PallHaraldsson · Pull Request #383 · JuliaInterop/RCall.jl · GitHub]. You can’t have the same good default for (very) long running (HPC) code, and short running scripts. There will always be trade-offs, at least two good defaults depending; and I admit, I see this third option --compile=min is only good for very short running scripts, after looking more into it. It still might be a good default while developing, before your optimization phase.
I was trying to find a good balance, minimizing compilation time, going towards Python-defaults, but I see I went way beyond that, with a similar loop there faster than with compile=min.
I tried “dogfooding” on one of my Julia scripts I made for work, where Julia’s default is 32% slower, by 5.3 sec than -O0 (that is also faster than -O1), or 44% slower on 1.6.0-DEV, by 5.86 sec, while the other option:
$ time ~/julia-1.3.1/bin/julia --startup-file=no fenics-db.jl
real 0m21,663s
$ time ~/julia-1.3.1/bin/julia --startup-file=no --compile=min fenics-db.jl
real 11m59,102s
Ouch. Still the header (what I put in using.jl) of the script is faster, and for some short running scripts the two second gain there might not be lost later in some script:
using CodecZlib # a wrapper, probably -O0 ok.
using CSV # highly tuned code. Probably optimization, shouldn't go lower, maybe it should selectively go higher and/or JLL?
using DataFrames
$ time ~/julia-1.6.0-DEV-8f512f3f6d/bin/julia --startup-file=no using.jl
real 0m3,678s
$ time ~/julia-1.6.0-DEV-8f512f3f6d/bin/julia --startup-file=no --compile=min using.jl
real 0m1,616s
In my ~/.julia/config/startup.jl I have only:
@time using Revise
println("Revise speed test") # to remind me how slow it is loading, why you should use --startup-file=no when benchmarking
I occasionally see very slow loading of even (this) one package, here I had forgotten to exclude it:
$ time julia fenics-db.jl
31.301598 seconds (2.85 M allocations: 106.293 MiB, 0.50% gc time)
Revise speed test
“good to know the option exist”
Yes, why I added the Julia issue to add it to --help, but I’m getting skeptical, maybe it should remain under the other undocumented:
$ ~/julia-1.6.0-DEV-8f512f3f6d/bin/julia --help-hidden
julia [switches] -- [programfile] [args...]
--compile={yes|no|all|min}Enable or disable JIT compiler, or request exhaustive compilation
[..]