Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise drastically slowing down all julia functionality after dev package is loaded #207

Closed
IanButterworth opened this issue Nov 13, 2018 · 5 comments

Comments

@IanButterworth
Copy link
Contributor

I'm seeing a drastic slowdown in all julia interaction after a dev package is imported, where Revise was imported in advance. Maybe this is also linked to #206 which I'm experiencing

Revise v0.7.12
Seen in Version 1.0.2 and Version 1.1.0-DEV.655 (2018-11-13)

Session with Revise.jl

> using Revise
 #takes a couple of seconds to complete

> 1
1 #<< 1 second

> @time 1
 0.000001 seconds (3 allocations: 144 bytes)
1 #<< 1 second

> using DevPackage
[ Info: Precompiling DevPackage [bb1973f0-dbbf-11e8-231b-73219c4de986]

> 1
1 #Hangs for ~ 10 seconds before returning

> @time 1
  0.000008 seconds (4 allocations: 160 bytes) #Hangs for 10 seconds before returning this line
1 #This line immediately after

Session without Revise.jl

> 1
1 #<< 1 second

> @time 1
 0.000001 seconds (3 allocations: 144 bytes)
1 #<< 1 second

> using DevPackage
[ Info: Precompiling DevPackage [bb1973f0-dbbf-11e8-231b-73219c4de986]

> 1
1 #About 1 second first time after above import

> 1
1 #<< 1 second

> @time 1
  0.000001 seconds (3 allocations: 144 bytes)
1 #<< 1 second
@IanButterworth
Copy link
Contributor Author

This seems to be linked to overuse of broad using's in my DevPackage. i.e. instead of using PyPlot I'm changing to using PyPlot: plot, figure, subplot, imshow

I see normal execution speeds for basic operations now following using Revise;using DevPackage

But is this expected behavior? For instance, is Revise triggered to poll for file changes in imported packages each time anything is executed?

@timholy
Copy link
Owner

timholy commented Nov 14, 2018

Can you post DevPackage? The thing to do here is try to strip it down to bare essentials.

I'm a bit skeptical that it's the using A: b, c, d, e, ... statement in and of itself (though of course if there's a Julia bug, anything is possible). To me, a more likely culprit is the following: DevPackage redefines some Base method that also gets used by Revise. As a consequence, methods in Revise (which run on every REPL cycle) need to be recompiled after you load the package.

@IanButterworth
Copy link
Contributor Author

Unfortunately I can't make DevPackage public, but these are all the global elements in the package:
However, in this format there's basically no delay in execution.

VERSION < v"0.7.0-beta2.199" && __precompile__(false)

module DevPackage

using ImageFiltering: KernelFactors, imfilter
using StatsBase: percentile
using PyPlot: plot, figure, subplot, imshow, plt, xlim, ylim, title, xlabel, ylabel
using Images, ProgressMeter, FileIO, Colors, CSV, DataFrames, Dates, TimeZones
using VideoIO
using SubpixelRegistration

using PyCall
const DevPythonPackage = PyNULL()

function __init__()
    pushfirst!(PyVector(pyimport("sys")["path"]), @__DIR__)
    copy!(DevPythonPackage, pyimport("DevPythonPackage"))
end

const ffmpeg = "ffmpeg"           #name of ffmpeg executable

# Plus uniquely named struct definitions and uniquely named functions

end

@timholy
Copy link
Owner

timholy commented Nov 14, 2018

I can't test this precisely without DevPythonPackage, but if I comment out your __init__ function then I can't replicate this.

Are you on Windows by any chance? See e.g. JuliaGraphics/Gtk.jl#325

@IanButterworth
Copy link
Contributor Author

I'm on MacOS, and unfortunately (from a debugging perspective) the issue has completely disappeared unexplainably. I've tried to roll back to figure out what it was but no luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants