FYI: 6+ times faster first-plot, and bug in Julia 1.6
PallHaraldsson opened this issue · comments
A. I noticed with (undocumated) option:
$ ~/julia-1.4.0/bin/julia --compile=min --startup-file=no
julia> @time using GRUtils
0.225255 seconds (124.72 k allocations: 8.963 MiB)
julia> @time (x = LinRange(0, 10, 500); y = sin.(x.^2) .* exp.(-x); plot(x, y))
0.531542 seconds (788.56 k allocations: 37.202 MiB, 2.49% gc time)
julia> @time (x = LinRange(0, 10, 500); y = sin.(x.^2) .* exp.(-x); plot(x, y))
0.309183 seconds (149.80 k allocations: 3.426 MiB)
The downside is the plot itself gets slower for subsequent, but 0.3 sec still isn't very noticeable. Seemingly you can lower a bit more with -O0
(and I guess -O1
) in addition, or get faster startup with it only, and for that graph, subsequent fast as fast as with default options.
The latter optimization was baked into Plots.jl, and may also apply here, the former, if you wish could be added as a hint to the README.
B. The example code from GR, and this here block seemingly forever with or without any Julia options:
$ ~/julia-1.6.0-DEV-8f512f3f6d/bin/julia --startup-file=no
julia> @time (x = LinRange(0, 10, 500); y = sin.(x.^2) .* exp.(-x); plot(x, y))
C. FYI: The time-to-first plot to beat now seems to be 0.28 sec. with Gaston.jl, a wrapper for Julia. See my comment there linking to my other comment: mbaz/Gaston.jl#131 (comment)
Thank you for reporting this. I'll look into it for subsequent versions.
It must be a bug in Julia(?), but since 1.6 (or 1.5) isn't released yet, I'm not sure I should report it there. You should maybe report it in if there's still a bug in 1.6 nightly or in released 1.5.
It works in my slightly older 1.5:
Commit ea669c3d3e (29 days old master)
but not in 1.6:
8f512f3f6d (15 days old master)
so useful for them to bisect.
Note, while they closed the Julia issue, it's still a bug in Julia, but they point to packages (wrongly I believe in you case), so be sure to check this out later. And the hang was for hours until I killed julia (for all kinds of different optimization levels, and for default).
Reported: JuliaLang/julia#36075
This is an old issue about old versions of Julia and packages. I close it, but feel free to reopen if this is still something to consider and have any new proposal about it.