Bad performance for dispatch-heavy code

@snoopi from SnoopCompile will tell you the top-level call to inference (which is the main cost of compilation). You can try explicitly precompiling specific calls, see e.g., https://github.com/JuliaDebug/JuliaInterpreter.jl/blob/master/src/precompile.jl which gets called during module definition from here.
I should say that precompilation doesn’t always “work” because of current limitations in the serialization format of *.ji files, but that is expected to change someday (Change precompilation format to be more amenable to copying by timholy · Pull Request #32705 · JuliaLang/julia · GitHub).

There’s also PkgCompiler but that may not be so helpful for a package that you’re working on extensively (you have to build Julia itself along with your package, and that is slow).

Reducing compile time is at the top of the priority list now (Compiler work priorities).

1 Like