Skip to content

Commit

Permalink
precompile functions to reduce compilation time of first plot
Browse files Browse the repository at this point in the history
  • Loading branch information
yhls committed Nov 13, 2019
1 parent eab5091 commit 50e4c47
Show file tree
Hide file tree
Showing 4 changed files with 690 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,7 @@ end

const CURRENT_BACKEND = CurrentBackend(:none)

include("precompile.jl")
_precompile_()

end # module
7 changes: 6 additions & 1 deletion src/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,12 @@ function test_examples(pkgname::Symbol, idx::Int; debug = false, disp = true)
@info("Testing plot: $pkgname:$idx:$(_examples[idx].header)")
backend(pkgname)
backend()
map(eval, _examples[idx].exprs)

# prevent leaking variables (esp. functions) directly into Plots namespace
m = Module(:PlotExampleModule)
Base.eval(m, :(using Plots))
map(exprs -> Base.eval(m, exprs), _examples[idx].exprs)

plt = current()
if disp
gui(plt)
Expand Down
Loading

0 comments on commit 50e4c47

Please sign in to comment.