-
Notifications
You must be signed in to change notification settings - Fork 65
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
Lazy load CondaPkg (and Pkg), I think LazyModules for that, or better option? #549
Comments
This is probably the best option, CondaPkg, loads very slowly, and even slower than I though, when not in the REPL, but in the REPL CAN be very fast. The problem is Pkg, and it's probably very hard for you to load it lazily, rather load CondaPkg lazyly, to not have to deal with the Pkg complexity. See here: JuliaLang/julia#55721 (comment) |
@cjdoris I'm considering, instead on lazy loading CondaPgk, to copy it over and include it into PythonCall. It's sort of trivial to do, yes code duplication, not usually wanted, but I was thinking then I could more easily trim it down to the bare minimum. Why? What's the benefit? Then CondaPkg (only) could just handle the Pkg dependency and its slowness... and that's ok/tolerable for something only needed for REPL/"UI package". It would in effect not be a breaking change for PythonCall users, at least for scripts, only no longer adding to Pkg's REPL mode. I've given up on making it fast again (you changing it, it's probably possible, but seems like a lot of maybe not wanted work for Julia). So it would mean if you want that mode you could need to to: How do you like that idea? And CondaPkg would rather depend on PythonCall for the shared code (or it could go to a third place). [While JSON3 parsing is super fast at runtime I believe, it's a bit slow to load, and then CondaPkg could rather use Python's JSON parsing... I kind of wanted that optimization for loading speed, and then it would need such an arrangement, but if decopled then I wouldn't bother with optimizing CondaPkg load speed. It is for sure not speed critical and basically only a UI package? I think CondPkg isn't just used for Python, but Conda/mamba in general, e.g. for R, so then it would be a bit strange to rely on Pythn too, just for JSON parsing...] |
FYI: I'm down to (still) a 2.6x regression from 1.10, down from 116x if I recall):
0.9 (nor 0.4) sec isn't good, but tolerable, and the overhead is still coming down. The missing precompiles should help further (though they are almost the same missing also in 1.10, so unclear why 1.11 still has a regression): precompile(Tuple{typeof(Base.setindex!), Base.EnvDict, Bool, String}) This 23x regression in 1.11 is the main culprit seemingly (and because of the 338x regression for Pkg, I though I had fixed), so it might be enough to fix that, or lazy load it by CondaPkg, and then possibly keep the Pkg REPL mode even:
|
I'm not in favour of code duplication - it is rarely the answer and makes maintenance a nightmare. I'm confident we can fix the slow-downs in CondaPkg directly. |
In CondaPkg, Pkg is only used in two places: (a) the Pkg REPL mode and (b) in the slow path of (a) Can probably be solved with some combination of more precompilation, moving the code into an extension, and only doing some bits in interactive mode. (b) Can probably be solved by only loading Pkg in the slow path (which is already slow so we don't care about any more slowdown). |
I meant moving, by duplicating/copying.. (then later removal in CondaPkg, but I was only, for now, offering exploring moving/duplicating into PythonCall, to see if viable; though if you disagree I wouldn't bother trying if you do not like the code ending up there). Moving implies (copy and) deleting at the source (at least eventually), and somebody need to do the deleting, yes, just not a priority for me. :) It shouldn't be deferred for long. I basically brought this up to see if you want PythonCall to load faster (somehow), and if you want me to look into at least doing part of the work. Lazy loading CondaPkg only doesn't seem to work because it's fully deferred until you lazily load it and it seems you need some of the code right away why it needs copying I think. Because importing is all or nothing. |
I don't think there's any code in CondaPkg that can be removed though - it's all needed for CondaPkg to run correctly. And remember that CondaPkg does not purely exist for PythonCall, it is useful in its own right, otherwise CondaPkg would just be a part of PythonCall (which it was a very long time ago). |
At least when I set:
ENV["JULIA_CONDAPKG_BACKEND"] = "Null"
I get: ERROR: InitError: CondaPkg is using the Null backend but Python is not installed
though, so not investigating further (I have Python installed).
With this one loads but not any faster (but should too):
The text was updated successfully, but these errors were encountered: