I’ve read that calls to using Plots can sometimes be slow but I wonder if as slow as I’m seeing is normal. On 3 trials after starting Julia from the command line I @timed this taking between 35 and 40 seconds.
After some Googling, I learned how to build my system image. After doing that I’m getting more like 19.7 seconds so that definitely makes a difference but 20 seconds still seems awfully long.
Also of note, using -j 2 tends to approximately double the time to run the using command.
Is there something I’m missing or is this just par for the course?
Julia Version 0.6.1
Commit 0d7248e (2017-10-24 22:15 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin14.5.0)
CPU: Intel(R) Core(TM) i5-4258U CPU @ 2.40GHz
WORD_SIZE: 64
uname: Darwin 16.7.0 Darwin Kernel Version 16.7.0: Wed Oct 4 00:17:00 PDT 2017; root:xnu-3789.71.6~1/RELEASE_X86_64 x86_64 i386
Memory: 8.0 GB (605.25 MB free)
Uptime: 1.069672e6 sec
Load Avg: 2.2373046875 2.3759765625 2.30517578125
Intel(R) Core(TM) i5-4258U CPU @ 2.40GHz:
speed user nice sys idle irq
#1 2400 MHz 625768 s 0 s 393018 s 2275837 s 0 s
#2 2400 MHz 329560 s 0 s 164461 s 2800507 s 0 s
#3 2400 MHz 620082 s 0 s 329063 s 2345384 s 0 s
#4 2400 MHz 340340 s 0 s 168468 s 2785719 s 0 s
Using master of Plots.jl is faster as it is precompiled, but still slow:
julia> @time using Plots
6.168379 seconds (4.04 M allocations: 219.459 MiB, 1.31% gc time)
julia> @time plot(1:3)
16.983929 seconds (10.69 M allocations: 569.126 MiB, 1.96% gc time)
then it still takes another 6s or so for the plot to show (pyplot backend). I use PyPlot.jl because I can’t be bothered to wait; that takes about 6s to first plot.
You should be able to make it fast (<1s) with a custom userimg. But for that you need to make sure all the important functions get compiled. Have a look at the readme of SnoopCompile.
I should write a tutorial on how to use Plotly,js with Pages.js. There is an undocumented Plotly.js example in Pages.jl (master). It is super fast and interactive
Edit: I should qualify “super fast” with this group I did not compare to other packages so it was more of an absolute statement about general satisfaction with the speed. I wouldn’t try anything super complicated and expect great performance. There are other great packages that are probably faster the plotly
I’ve been working on this problem in MakiE, which is a new design prototype for Plots, with only the glvisualize backend for now.
I just did the following benchmarks:
The trick is to make your package precompile save and use snoop compile, to emit precompile statements to tell julia what functions to compile binary for, when included in the system image.
I will create a package and instructions for what I did to make loading fast! This could be part of Pkg.build().
Of course, it’s 4.7 seconds after starting Mathematica (v11), which makes this comparison all the more striking. I really hope Simon is able to keep the performance at this level as he continues to flesh out MakiE. @sdanisch, is it reasonable to expect that the libuserimg.so approach could remain transparent to the user, and indeed make it part of the Pkg.build() process?
For Makie I plan to have a Pkg.build() process, which can be steered by environment variables for now.
I will see @StefanKarpinski thinks about integration into Pkg3. From all I heard, the plan is to improve caching of compiled binary for Julia in 1.0, so maybe this will become a natural part of Julia anyways.
As of 1.4, I get 6 seconds (after precompile), so not fully fixed yet but about 3x better. It’s still improving though. 1.4 is better than 1.3, and 1.5 will be better than 1.4 was.
Gnuplot.jl (master branch, new release due in a few days) takes ~5 seconds with the default qt terminal, and no precompilation or modified system image:
.
I can confirm that both Gaston and Gnuplot are very capable. And FAST. I highly recommend this to anyone who is looking for fast plotting. Knowledge of gnuplot is a plus, of course, but for someone programming in Julia that shouldn’t be a problem.
There’s no real need to do this redundantly (might still happen in real-world code), but using only gets stable (allocations/speed) on third use (unlike for Gaston, where it only applies to the plot):
julia> @time using Plots
9.869769 seconds (7.44 M allocations: 422.704 MiB, 2.78% gc time)
julia> @time using Plots
1.492128 seconds (1.70 M allocations: 80.019 MiB, 1.90% gc time)
julia> @time using Plots
0.000298 seconds (276 allocations: 14.859 KiB)
What version are you on? On Master, I’m seeing 3 seconds, which while not solved, is a massive improvement. (time julia -e “using Gaston” also clocks in at just over 1 second for me)