JuliaPlots/Plots.jl

[FR] Improve performance of plotting heatmaps

Open

#4520 aperta il 15 nov 2022

Vedi su GitHub
 (13 commenti) (1 reazione) (0 assegnatari)Julia (381 fork)batch import
help wantedperformance

Metriche repository

Star
 (1943 star)
Metriche merge PR
 (Merge medio 13g 6h) (2 PR mergiate in 30 g)

Descrizione

Reported on Slack by Jesse Chan, repeated calls to plot! to produce overlying heatmaps was very slow.

const mat = randn(512, 512)

function f(x, n)
    plot()
    for _ in 1:n
        heatmap!(x)
    end
end

f(mat, 100)

Allocation profiler shows the large majority of allocations occurring in heatmap_edges: image

And the large majority of computation time in expand_extrema! (which calls heatmap_edges) and update_clims (my old nemesis): image

Guida contributor