-
-
Notifications
You must be signed in to change notification settings - Fork 297
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
Generate precompile directives via PrecompileSignatures.jl #2054
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="rh/precompilesignatures")
julia> using Pluto |
@fonsp @Pangoraw I think this is good to go. Can you review? I've added 32-bit tests at rikhuijzer/PrecompileSignatures.jl#3 and those pass too. I haven't tested package relocatability because I don't know how to test that. Help is welcome. I don't expect problems with that because the precompile directives are generated automatically, but better safe than sorry I guess. I have also tested the package now in |
Does https://github.com/rikhuijzer/PrecompileSignatures.jl use internal Julia API? Like If so, can you wrap this in a try-catch, or something similar, to avoid issues with running Pluto on future Julia versions? |
The Still, you made a good point. So, in version two of |
And another benchmark to be surer. This time on my laptop with Julia 1.7.3 main
This PR
Really promising speed gains. NB. It is also promising that this setup extends the toolbox when working on TTFX. |
Awesome, thanks for the changes! Also see rikhuijzer/PrecompileSignatures.jl#8 |
After manually adding a lot of
precompile
directives in earlier PRs such as the following:precompile
forSessionActions.open
#1934it seemed that there should be a better way. What if we could automatically generate precompile directives? Of course, guessing what types are going to be put into functions is impossible to predict without actually running code and keeping track of calls via
SnoopCompile.jl
, but what we can do is read the method signatures from the package and generate precompile directives for any concrete signatures. Yes, it's a very brute force way, but if it works it works.This PR demonstrates the new and yet unregistered
PrecompileSignatures.jl
package. This package reads the method signatures insidePluto.jl
and generates about 415 precompile directives from that.Benchmarks
With Julia 1.8-beta3:
main
Precompilation time: 8 seconds
This PR
Precompilation time: 12 seconds
EDIT: Earlier versions of this comment showed less promising results. This was due to me enthusiastically removing all manually added
precompile
directives; even the ones which couldn't be automatically added by PrecompileSignatures.jl.