JuliaPy / PyPlot.jl

Plotting for Julia based on matplotlib.pyplot
https://github.com/JuliaPy/PyPlot.jl
MIT License
478 stars 88 forks source link

`using PyPlot` on 0.7 takes several minutes #361

Closed Datseris closed 6 years ago

Datseris commented 6 years ago

I am sure that this has been noticed but I couldn't see any issue for it so I am opening one.

In Julia 0.7beta and PyPlot 2.5 doing using PyPlot takes several minutes: I have timed it to 3-4 minutes give or take. This is significantly slower than what happens on Julia 0.6.

This is on Windows 10.

stevengj commented 6 years ago

Is it several minutes even after precompiling? On my machine (Mac) it takes 53 seconds, which is far worse than in 0.6, but it seems to be partly a Julia issue — see JuliaLang/julia#27861.

Datseris commented 6 years ago

In my machine it takes

julia> @time using PyPlot
┌ Warning: `convert(::Type{VersionNumber}, v::AbstractString)` is deprecated, use `VersionNumber(v)` instead.
│   caller = __init__() at init.jl:178
└ @ PyPlot init.jl:178
173.899786 seconds (193.56 M allocations: 11.314 GiB, 10.52% gc time)

(notice that there are still depwarnings)

I am not running this on a super-computer but it is still a decent machine, so I wouldn't expect something so low... but you pointed at the main Julia repo so probably it is not exclusive to PyPlot.

mcreel commented 6 years ago

julia> @time using PyPlot 26.616278 seconds (40.97 M allocations: 2.169 GiB, 3.27% gc time)

This is on a Macbook Air, running Linux, and PyPlot master.

Datseris commented 6 years ago

After updating to master branch and recompiling, closing Julia and then

julia> @time using PyPlot
179.559343 seconds (191.33 M allocations: 11.238 GiB, 2.01% gc time)

I don't know how mcreel gets these numbers...

ufechner7 commented 6 years ago

Did you update to the master branch of Julia or of PyPlot? In particular Julia master is now much improved. Nevertheless the load time on my computer is still more than twice with Julia 0.7 than in was with Julia 0.6, see: https://github.com/JuliaLang/julia/issues/27861

mcreel commented 6 years ago

I'm using julia Version 0.7.0-beta.0, which I obtained by git clone and checking out that version. It's compiled on my machine. PyPlot is from master. I'm hoping that the time drops considerably more as the julia 1.0 ecosystem starts to stabilize!

ufechner7 commented 6 years ago

After beta.0 there have been already two fixes that helped a lot.

mcreel commented 6 years ago

Compiling now, will report back.

Here are the current results, a little better using Julia master as of now. The previous time, I had fixed the deprecation warning, I recall now.

julia> @time using PyPlot ┌ Warning: convert(::Type{VersionNumber}, v::AbstractString) is deprecated, use VersionNumber(v) instead. │ caller = init() at init.jl:178 └ @ PyPlot init.jl:178 22.735591 seconds (42.98 M allocations: 2.345 GiB, 3.66% gc time)

julia>

ufechner7 commented 6 years ago

Starting julia with "julia --depwarn=no" should give you a slightly better startup time. Still not good, though.

ufechner7 commented 6 years ago

Issue is more than fixed on Julia master. Load time now about 20% faster than on 0.63! :) see: JuliaLang/julia#27861

Datseris commented 6 years ago

Cool, nightlies for windows are still 6 days old master, so I can't test (I don't know how to compile from scratch). Will test once nightlies are updated.

EDIT: the package has still deprecation warnings by the way, which do slow things down:

┌ Warning: Deprecated syntax `try without catch or finally` at C:\Users\datseris\.julia\packages\PyPlot\16Fy\src\PyPlot.jl:285.
└ @ PyPlot.jl:285
WARNING: importing deprecated binding Base.connect into PyPlot.
WARNING: Base.connect is deprecated: it has been moved to the standard library package `Sockets`.
Add `using Sockets` to your imports.
  likely near C:\Users\datseris\.julia\packages\PyPlot\16Fy\src\PyPlot.jl:187
┌ Warning: `convert(::Type{VersionNumber}, v::AbstractString)` is deprecated, use `VersionNumber(v)` instead.
│   caller = __init__() at init.jl:178
└ @ PyPlot init.jl:178
stevengj commented 6 years ago

@Datseris, the deprecations are fixed on master. In general, to use 0.7-beta, you currently need master versions of many packages.

Datseris commented 6 years ago

Thanks Steven, everything is fast as lightning now (at current master - I am guessing metadata isn't merged because I Can't update to a 2.6 version).