Plots.jl precompile performance

Is there a lightweight version or workflow for Plots.jl that doesn’t precompile all the backends and dependencies? Most users will only need to use a small subset of backends from one environment, or maybe ever. Could the dependencies be loaded on demand?

I added Plots to get UnicodePlots and it precompiled in 268 s. The first time I know is the worst case scenario. I know from experience this will bog down my Pkg.update precompiles. I could pin Plots, I suppose.

Matplotlib compiles much faster. It has the idiosyncratic user interface that it has. I wish I could use Plots’s elegant unified interface as an efficient entry point for more backends, but it seems that having Plots as a frontend dependency adds a lot of overhead.

Am I doing something wrong?

t does not precompile all the backends, and a lot of care has been taken to only load dependencies on demand. I think plotting packages are just complex to compile - Makie is even larger. The time-to-first-plot with Plots has classically been one of the biggest pain points in Julia, but has improved a lot in recent versions. It is fairly fast now, but yeah, precompiles when adding new packages does take time.

That’s great Plots.jl does load packages on demand.

This was my result for
] add Plots, UnicodePlots

113 dependencies successfully precompiled in 268 seconds. 107 already precompiled.

I guess Plots’s builtin flexibility with calls and keywords leads to a large graph of methods. Smart stuff for a complicated problem.

What I do is have a default julia environment that is almost empty (except for Revise) and then add packages to specific project environments as I need them. That way I don’t need to precompile every single installed package every time I add something.

On my Macbook Air I get

] add Plots, UnicodePlots
40 dependencies successfully precompiled in 97 seconds. 154 already precompiled.

Still not fast, but better.

Thanks for that test. I also do the same with my julia environments. I only have Revise and IJulia in the base 1.11 environment, and MAT, NCDatasets, and PyPlot in the local environment.

I was also using my old slow server (where my data are) for that last compile. That’s where I feel slow compiles the most.