Bokeh.jl icon indicating copy to clipboard operation
Bokeh.jl copied to clipboard

[TODO] TTFP

Open cjdoris opened this issue 3 years ago • 2 comments

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 avatar May 14 '22 18:05 cjdoris

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 avatar May 14 '22 18:05 cjdoris

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.

cjdoris avatar May 14 '22 18:05 cjdoris