Source
Synced / linked to GitHub for 1:1 mirror (2026-07-26).
Context
Julia 1.10+ supports PrecompileTools.jl workloads that precompile frequently-used methods at package install time, reducing first-call latency.
Currently, first call to SparseBrain(), step!(), or EnsembleBrain() triggers JIT compilation, which can take several seconds.
Goal
Add precompilation workloads for the most common operations.
Implementation
1. Add PrecompileTools dependency
[deps]
PrecompileTools = "aea7be01-6a6a-4083-8856-8d6e0d60b6f9"
2. Add workloads (src/LiquidCortex.jl)
using PrecompileTools
@compile_workload begin
# Precompile SparseBrain constructor
if _cuda_available[]
brain = SparseBrain(20.0f0; n_in=8, n_out=4, name="precompile")
u = CUDA.zeros(Float32, 8)
step!(brain, u; inhibition=0.5f0)
get_output(brain)
ensemble = EnsembleBrain(; n_in=8, n_out=4)
ensemble_step!(ensemble, u; inhibition=0.3f0)
get_ensemble_output(ensemble)
end
end
3. Keep workloads minimal
Precompilation runs at install time — keep it fast:
- Use small dims (n_in=8, n_out=4) not full size
- Only precompile the hot path (SparseBrain + step!)
- Skip reference LSM (lazy-init, not critical path)
Acceptance criteria
Labels
performance, enhancement
Source
Synced / linked to GitHub for 1:1 mirror (2026-07-26).
Limen-Neural/LiquidCortex.jlGH#24Context
Julia 1.10+ supports
PrecompileTools.jlworkloads that precompile frequently-used methods at package install time, reducing first-call latency.Currently, first call to
SparseBrain(),step!(), orEnsembleBrain()triggers JIT compilation, which can take several seconds.Goal
Add precompilation workloads for the most common operations.
Implementation
1. Add PrecompileTools dependency
2. Add workloads (
src/LiquidCortex.jl)3. Keep workloads minimal
Precompilation runs at install time — keep it fast:
Acceptance criteria
PrecompileTools.jladded to deps@compile_workloadblock addedusing LiquidCortexload time measurably reducedLabels
performance,enhancement