Pluto.jl
Pluto.jl copied to clipboard
Import PlutoRunner as module in Loader.jl
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
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:
- Now using
LOAD_PATH
andBase.ACTIVE_PROJECT
instead ofpkg_ctx
(this fixed the tests) - NotebookBootEnvironment.toml no longer needed, since PlutoRunner is the only "dependency"
- Bit cleaner with
try ... finally
We still need to test:
- [ ] Does this improve launch time? (@rikhuijzer can you use the new benchmark system to test this?) EDIT: looks like there is almost no difference...
- [x] How do different Pluto versions interfere? (@fonsp will do this) EDIT: works just like before
- [x] What about RelocatableFolders.jl? (Was that working before?) EDIT: very likely that it will work
Nice! I ended up rewriting the whole thing:
Now using
LOAD_PATH
andBase.ACTIVE_PROJECT
instead ofpkg_ctx
NotebookBootEnvironment.toml no longer needed, since PlutoRunner is the only "dependency"
Bit cleaner with
try ... finally
Eyeroll... 😉
- [ ] What about RelocatableFolders.jl? (Was that working before?)
I'll test it, but I'm pretty sure that still works as RelocatableFolders will "just" create the whole runner
folder.
Does this improve launch time? (@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 add some PlutoRunner benchmarks.
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 https://github.com/fonsp/Pluto.jl/pull/1881#issuecomment-1072529301, 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 Main.PlutoRunner
... needs more thinking
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 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 Main.PlutoRunner... needs more thinking
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:
- Wait for CI
- Rerun benchmark from Paul's previous commet
Benchmark results
On main (b15d420
)
julia> import Pluto
@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
8.171571 seconds (190.23 k allocations: 14.144 MiB, 0.54% compilation time)
"2"
This PR
julia> import Pluto
@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
6.713073 seconds (178.20 k allocations: 13.227 MiB, 0.33% compilation time)
"2"
lets merge!
On Julia 1.9, launching the second notebook in a session with Malt went from 4 seconds to 3 seconds :)