-
-
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
Precompilation for faster Pluto startup #1392
Conversation
This is exciting! |
It looks like (from the timings above) that about 20% of the startup time is due to compilations. Ideally we could be able to move this part mostly to precompilation. In the current state, this PR reduces precompilation times by about 2/3. The remaining 80% of the Pluto startup time seems not to be related to compilation times. |
Cool! I tried this but didn't manage, but it might still be useful to look at: https://github.com/fonsp/Pluto.jl/tree/precompile-during-precompile I'll have more time to look at the PR after my break! Be sure to also time |
Maybe |
Can you time |
Current main: PS C:\Users\benlu.julia\dev\Pluto\test> julia -e '@time using Pluto' 0.773140 seconds (1.08 M allocations: 69.001 MiB, 3.10% gc time) 0.792773 seconds (1.08 M allocations: 69.002 MiB, 3.01% gc time) 0.830735 seconds (1.08 M allocations: 69.001 MiB, 3.61% gc time) PS C:\Users\benlu.julia\dev\Pluto\test> julia notebook_startup.jl 34.839933 seconds (36.48 M allocations: 2.089 GiB, 2.14% gc time, 18.12% compilation time) 30.045399 seconds (36.48 M allocations: 2.090 GiB, 2.56% gc time, 21.94% compilation time) 31.160570 seconds (36.48 M allocations: 2.090 GiB, 2.53% gc time, 23.23% compilation time) With this PR: PS C:\Users\benlu.julia\dev\Pluto\test> julia -e '@time using Pluto' 0.965575 seconds (1.38 M allocations: 88.982 MiB, 2.54% gc time) 0.944487 seconds (1.38 M allocations: 88.982 MiB, 2.36% gc time) 0.998248 seconds (1.38 M allocations: 88.980 MiB, 2.48% gc time) PS C:\Users\benlu.julia\dev\Pluto\test> julia notebook_startup.jl 29.648578 seconds (40.87 M allocations: 2.339 GiB, 2.48% gc time, 7.97% compilation time) 33.155839 seconds (40.87 M allocations: 2.339 GiB, 2.42% gc time, 8.51% compilation time) 31.700384 seconds (40.86 M allocations: 2.339 GiB, 2.34% gc time, 7.49% compilation time) Looks like there are no consistent speed-ups with this PR (anymore?). Pure |
In SciML a trick is used for reducing startup times - essentially it is just including a minimal example inside the source code module itself. This example is then executed in precompilation stage and the functions it requires are then already compiled when the user need them.
See
https://discourse.julialang.org/t/22-seconds-to-3-and-now-more-lets-fix-all-of-the-differentialequations-jl-universe-compile-times/66313
and
https://github.com/SciML/OrdinaryDiffEq.jl/blob/v5.61.1/src/OrdinaryDiffEq.jl#L175-L193
For measuring startup performance, I used the following script:
Before:
After:
Edit: updated timings not running on battery power anymore. This gives more consistent timings, but unfortunately a less dramatic improvement with this PR. But still the startup time is improved significantly.
Also the "standard" Pluto startup feels significantly faster.
Pretty sure more could be done here by including more Pluto functionality for precompilation.