-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
Import PlutoRunner as module in Loader.jl #1881
Conversation
Try this Pull Request!Open Julia and type: julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/fonsp/Pluto.jl", rev="PlutoRunner-as-module")
julia> using Pluto |
Nice! I ended up rewriting the whole thing:
|
We still need to test:
|
Eyeroll... 😉 |
I'll test it, but I'm pretty sure that still works as RelocatableFolders will "just" create the whole |
src/runner/Loader.jl
Outdated
# The goal of this file is to import PlutoRunner into Main. | ||
# | ||
# This is difficult because PlutoRunner uses standard libraries and packages that are not necessarily available in the standard environment. | ||
# | ||
# Our solution is to create a temporary environment just for loading PlutoRunner. This environment is stored in `.julia/environments/__pluto_book_v*_*/`, and used by all notebook launches. Reusing the environment means extra speed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great comment. I was already confused about the code below this
Hard to tell since this branch isn't up-to-date with |
Let me rebase! Sorry about that |
Updated! The main benefit should be in the launch time of the second notebook, because PlutoRunner can be precompiled like a package.
… Op 18 mrt. 2022, om 16:37 heeft Rik Huijzer ***@***.***> het volgende geschreven:
Does this improve launch time? ***@***.*** <https://github.com/rikhuijzer> can you use the new benchmark system to test this?)
Hard to tell since this branch isn't up-to-date with main. I've manually added the compile tests on top of this branch and it doesn't look off. Some stuff of the PlutoRunner is covered via SessionActions.open. I should definitely some PlutoRunner benchmarks.
Don't let performance nitpicks come in the way of features :) We can always optimize later.
—
Reply to this email directly, view it on GitHub <#1881 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABU4YBUMV2EQLMYIZ2TZJ3DVASPNLANCNFSM5NKYHFFA>.
You are receiving this because you were mentioned.
|
This PR can cause problems when you use Pluto inside Pluto, at a different version than the server. But that problem might already be there because we check the existence of EDIT: this might only be an issue when not using distributed computing, but that might already be a problem before this PR. |
With 1.9 it might be interesting to revisit this PR. Here are some unscientific measurements: On main (julia 1.9-rc2): julia> @time let
nb = Pluto.Notebook([Pluto.Cell("1 + 1")])
sess = Pluto.ServerSession()
Pluto.update_run!(sess, nb, nb.cells)
nb.cells[1].output.body
end
7.291519 seconds (164.88 k allocations: 12.471 MiB, 0.29% compilation time)
"2" With the loader as a package, this pr (julia 1.9-rc2): julia> @time let
nb = Pluto.Notebook([Pluto.Cell("1 + 1")])
sess = Pluto.ServerSession()
Pluto.update_run!(sess, nb, nb.cells)
nb.cells[1].output.body
end
5.720203 seconds (164.12 k allocations: 12.435 MiB, 0.36% compilation time)
"2" Note that there are no precompile statements in PlutoRunner itself so it can probably be improved more?
This problem will be solved when we enable Malt so that each Pluto instance can drive its own notebook processes independently. |
I'd like to add that apart from precompilation time this PR (making PlutoRunner its own package with UUID) will open up a lot of possibilities regarding building package extensions to do Pluto specific stuff. At the moment one has to rely on AbstractPlutoDingetjes but having a Pluto-functionality extensions for packages that are loaded when PlutoRunner is loaded (so inside Pluto) would be super nice! |
Woohooo almost ready! We thought hard about interference between Pluto versions and nested Pluto and it will be fine! TODO:
|
Benchmark resultsOn main (
|
lets merge! |
On Julia 1.9, launching the second notebook in a session with Malt went from 4 seconds to 3 seconds :) |
No idea if this is faster currently, or if it will every be...
But apart from having to do
Pkg.develop()
this feels like a more mature way to load PlutoRunner :P