Speculator.jl reduces latency by automatically searching for compilable methods.
julia> using Pkg: add
julia> add("Speculator")
julia> using Speculatorjulia> module Showcase
export g, h
f() = nothing
g(::Int) = nothing
h(::Union{String, Symbol}) = nothing
end;
julia> speculate(Showcase; verbosity = compile)
compile: Main.Showcase.g(::Int64)
compile: Main.Showcase.f()
julia> speculate(Base.isexported, Showcase; verbosity = pass)
pass: Main.Showcase.g(::Int64)
julia> speculate(Showcase.h; verbosity = compile) do m, n
!(m == Core && n == :String)
end
compile: Main.Showcase.h(::Symbol)
julia> speculate(Showcase.h; limit = 2, verbosity = compile ∪ pass)
pass: Main.Showcase.h(::Symbol)
compile: Main.Showcase.h(::String)
julia> install_speculator(; limit = 4, verbosity = compile)
julia> i(::Union{String, Symbol}, ::AbstractChar) = nothing;
compile: Main.i(::Symbol, ::LinearAlgebra.WrapperChar)
compile: Main.i(::String, ::LinearAlgebra.WrapperChar)
compile: Main.i(::Symbol, ::Char)
compile: Main.i(::String, ::Char)- Precompile packages
- Compile interactively
- Filter values
- Run in the background
- Handle abstractly typed methods
- Save compilation directives to a file
- Show logging statements
- Disable during development using Preferences.jl?
- Support for
UnionAlltypes?
- Cthulhu.jl
- JET.jl
- LookingGlass.jl
- MethodAnalysis.jl
- MethodInspector.jl
- PkgCacheInspector.jl
- SnoopCompile.jl
Credit to Cameron Pfiffer for the initial idea.
The preexisting package PrecompileSignatures.jl implements similar functionality,
notably that PrecompileSignatures.@precompile_signatures ::Module
is roughly equivalent to Speculator.speculate(::Module).
The idea to compile concrete method signatures has also been brought up in PrecompileTools.jl #28.