cjdoris / Bokeh.jl

Interactive plotting made easy
https://cjdoris.github.io/Bokeh.jl
Other
77 stars 3 forks source link

[TODO] TTFP #4

Open cjdoris opened 2 years ago

cjdoris commented 2 years ago

The following benchmark takes 5.5 seconds on my machine the first time, and 0.2 seconds subsequently:

@time begin
    using Bokeh
    Bokeh.settings!(use_browser=true)
    p = figure()
    plot!(p, Scatter, x=randn(1000), y=randn(1000))
    display(p)
end

Adding the following to the top of the module decreases TTFP to 4.0 seconds, and subsequent times are still 0.2 seconds:

Base.Experimental.@compiler_options optimize=0 compile=min
cjdoris commented 2 years ago

Putting @time on each line, we get: 0.9, 0.0, 1.5, 0.5, 2.5. Subsequently, all the time is in display(p).

With the compiler options set, we get: 0.7, 0.0, 0.3, 0.4, 2.4.

cjdoris commented 2 years ago

Precompiling figure() brings line 3 down to 0.7 seconds (5 seconds total).

A few more precompiles brings it down to 4.8 seconds total.