Fix invokelatest
bottleneck by using scheduling
#50
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One of the biggest negatives of Revise is that it slows package loading. It turns out that the majority of the bottleneck comes from having the callbacks be made with
invokelatest
: if you change this line tocallback(mod)
it dramatically cuts the load time. Unfortunately, with that change, I find that I can'tpush!
a callback toBase.package_callbacks
from within the module's__init__
method due to world age problems.Fortunately, the simple trick in this PR basically fixes the problem.
Demo, starting with
julia --startup-file=no
so I avoid loading Revise by default (using Julia 0.6, it's much worse on 0.7, 4s vs 13s):Revise master
Without using Revise
With this branch
CC @vchuravy (in case this trick might help Requires.jl). @vtjnash, could we change those to plain
invoke
if the module__init__
could use@schedule_for_next_worldage_update push!(Base.package_callbacks, mycallback)
?