You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A recent PR in JuliaML/MLDatasets.jl#128 raises the need to make dependency loading lazily so that the overall @time using XXX for whatever umbrella package as fast as possible.
For this reason, I created LazyModules.jl, it's quite convenient to use, but requires a careful handle of the world-age issues.
A typical use case of @lazy macro is a black box package where we don't require the internal types. For instance,
using ImageMorphology
img =rand(RGB, 64, 64)
erode(img)
Here the erode function is a perfect example: it doesn't output alien types to the caller. Thus we can try to @lazy import ImageMorphology so that users who don't require morphological features don't need to pay for the latency of ImageMorphology.
To properly achieve this without breaking people's code, we'll need to revisit the internal types and ensure that necessary core types and methods are eagerly loaded. As an outcome, there might be a few new "Core" packages, e.g., ImageMorphologyCore.
This trick is adopted in FileIO and ImageIO for many years and it's working quite well (except that occasionally people hit world-age issues because the supporting packages output alien types). With the new LazyModules, it's perhaps a good idea to adopt this
trick more widely to JuliaImages and perhaps other ecosystems.
The text was updated successfully, but these errors were encountered:
A recent PR in JuliaML/MLDatasets.jl#128 raises the need to make dependency loading lazily so that the overall
@time using XXX
for whatever umbrella package as fast as possible.For this reason, I created LazyModules.jl, it's quite convenient to use, but requires a careful handle of the world-age issues.
A typical use case of
@lazy
macro is a black box package where we don't require the internal types. For instance,Here the
erode
function is a perfect example: it doesn't output alien types to the caller. Thus we can try to@lazy import ImageMorphology
so that users who don't require morphological features don't need to pay for the latency ofImageMorphology
.To properly achieve this without breaking people's code, we'll need to revisit the internal types and ensure that necessary core types and methods are eagerly loaded. As an outcome, there might be a few new "Core" packages, e.g.,
ImageMorphologyCore
.This trick is adopted in FileIO and ImageIO for many years and it's working quite well (except that occasionally people hit world-age issues because the supporting packages output alien types). With the new LazyModules, it's perhaps a good idea to adopt this
trick more widely to JuliaImages and perhaps other ecosystems.
The text was updated successfully, but these errors were encountered: