JunoLab / Weave.jl

Scientific reports/literate programming for Julia
http://weavejl.mpastell.com
MIT License
821 stars 94 forks source link

display plot is slow #432

Closed clouds56 closed 2 years ago

clouds56 commented 3 years ago
@time using Plots # tag-import
import Markdown
@time for (d, feat) in collect(zip(data, feats))[1:3] # tag-all: takes >300s
  @time display(Markdown.parse("## `$feat`")) # tag-md
  colnames = propertynames(d)
  @time plots = [Feat.plot_feat(d[!, colname]; name=colname) for colname in colnames] # tag-plot: takes average ~2s
  @time display(@time plot(plots..., layout=(length(plots), 1), size=(800, 300*length(plots)))) # tag-inner: inner average <1s, tag-outer: outer takes [30, 120, 150] seconds
end

I think this is not related to first plot time and actually there's something wrong inside display, the time seems increasing (the output plot is almost the same)

output like this

tag-import:  0.000372 seconds (137 allocations: 9.891 KiB)
tag-md    :   0.000228 seconds (134 allocations: 8.344 KiB)
tag-plot  :   2.727499 seconds (409.84 k allocations: 960.588 MiB, 8.04% gc time, 29.44% compilation time)
tag-inner :   0.231747 seconds (8.08 k allocations: 175.876 MiB, 41.44% gc time)
tag-outer :  30.318927 seconds (24.10 M allocations: 1.392 GiB, 1.99% gc time)
tag-md    :   0.000184 seconds (133 allocations: 8.438 KiB)
tag-plot  :   1.634230 seconds (69.91 k allocations: 940.056 MiB, 8.27% gc time)
tag-inner :   0.088039 seconds (8.07 k allocations: 175.872 MiB)
tag-outer : 126.838568 seconds (23.95 M allocations: 1.387 GiB, 0.52% gc time)
tag-md    :   0.000234 seconds (133 allocations: 8.500 KiB)
tag-plot  :   1.874118 seconds (69.91 k allocations: 940.056 MiB, 7.38% gc time)
tag-inner :   0.238603 seconds (8.07 k allocations: 175.868 MiB, 48.30% gc time)
tag-outer : 154.335929 seconds (23.94 M allocations: 1.387 GiB, 0.46% gc time)
tag-all   : 317.732765 seconds (72.54 M allocations: 6.940 GiB, 0.77% gc time, 0.25% compilation time)
clouds56 commented 2 years ago

I find out that the actual render would be done in display.