'using Plots' takes 20 seconds or more



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
  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

Beginner installing and trying to use JuliaPro on Windows - extremely slow experience

It’s a known problem.


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 :+1:

Edit: I should qualify “super fast” with this group :sweat_smile: 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 :slight_smile:


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:

Plotting one million points in 3s start to end :slight_smile:

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().


Whaaat??? This looks like a game-changer!

[EDIT: for comparison, something like this takes like 4.7 seconds in Mathematica (3,3GHz Core i7)]


Mathematica used to take 30 seconds to start up when I last used it. (Old iMac.) perhaps it’s preloading the Plot[] code :grinning:


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.


That would be awesome! It really pains me every time google spits back at me that old article complaining about precompilation times in Julia.