2025-07-23 –, Main Room 1 (Main stage)
Compilation latency in the package ecosystem has been effectively reduced through improvements to type inference and package precompilation. This talk discusses several tools to reduce latency and introduces Speculator.jl, which searches for compilable method signatures from a callable value or module. In a single line of code, Speculator.jl can be used to precompile a package or automatically compile methods in the background of an interactive session.
A substantial amount of effort has been directed towards reducing compilation latency. This effort has been successful such that most commonly used packages have little latancy, or at least substantially reduced latency compared to earlier versions of Julia. Package precompilation is able to reduce latency by moving the compilation of a method from occurring during each session to occurring once during package installation. There are several tools to assist performing package precompilation, each with their own advantages and disadvantages.
Speculator.jl is a new package to reduce latency, which may be used as a supplement or alternative to pre-existing tools. Given a callable value, speculate
will use reflection to search its compilable method signatures. Given a module, speculate
will recursively search each of the values contained within. These method signatures may be logged, compiled, and saved to a file as precompilation directives. Additional configuration enables skipping specified values, running in a background task, and handling abstractly typed method signatures.
A substantial amount of time spent in an interactive session is "idle". This idle time may instead be put to use by the novel feature implemented in install_speculator
, which installs a hook into the REPL. Then, each input automatically runs speculate
in a background task. This is appropriate to be placed in a startup.jl
file and may reduce latency in interactive sessions.
This talk briefly explains the problem of latency and elaborates on the pre-existing tools to reduce it. Then, it introduces Speculator.jl as a supplement or alternative to them, instructs upon its usage for package precompilation and interactive sessions, and explains notable implementation details. Finally, it discusses the advantages and disadvantages of Speculator.jl relative to other latency reduction tools.
Jakob is a software developer based in Portland, Oregon who loves programming in Julia, Rust, and Typst. They have registered three Julia packages, are attending JuliaCon for the third time, is an organizer with Julia Gender Inclusive, and is the administrator of the Humans of Julia Discord server. When Jakob is away-from-keyboard, they enjoy watching movies, training for triathlons, and trying new vegan foods.