There’s not always a trade-off. Sometimes it’s just a win-win, why my PR for JLL packages was finally merged, and they all will use -O0
, but I’m told they all first need to get a new version out to trigger code generation.
See: GitHub - JuliaPackaging/Yggdrasil: Collection of builder repositories for BinaryBuilder.jl
Anyway if you want fast plotting with default settings:
(@v1.6) pkg> add GR#master # there's a performance regression for using for latest version, and I filed an issue, and it's fixed on master
julia> @time using GR
0.221278 seconds (68.59 k allocations: 5.280 MiB) # the author claims 0.17 sec, maybe it's with non-default settings
and FYI:
$ julia --startup-file=no -O1
julia> @time using GR
0.150216 seconds (68.59 k allocations: 5.280 MiB)
The non-first plot shouldn’t be slower, even with -O1
, as the heavy lifting is done by a native code precompiled library, and the same would apply for all JLL packages. My PR (at BinaryBuilder.jl) to default to -O0 for JLL packages, was finally merged to speed up loading (using
) those packages. But the rest of your code will be affected by non-default settings used (globally or locally in modules, as of 1.5). With more JLL packages, we’re up to 441 JLL package, we’ll have more of a Python feeling, best of both worlds:
E.g. already got the treatment:
julia> @time using LibPQ_jll
0.404593 seconds (366.31 k allocations: 21.175 MiB, 2.87% gc time)
still the main package (as it as other slow dependencies, not yet JLL):
julia> @time using LibPQ
9.215787 seconds (16.41 M allocations: 834.362 MiB, 4.51% gc time)
with -O0:
julia> @time using LibPQ
6.377934 seconds (16.41 M allocations: 834.320 MiB, 6.54% gc time)
For some reason -O0
is also used for Python 3 code, which actually beats the Julia code (we need to look into that):
https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/regexredux-python3-2.html