playbook-perf
Skill0 starsChanged 4 days agoMITView on GitHub
Make Julia code faster, from package loading to a hot loop. Use for a Julia performance task that needs a baseline, localization, one measured change, and a regression guard.
In this repository55 other files it gives its agents.
- advanced-optimizationSkill
- bayesian-inferenceSkill
- bayesian-pinnSkill
- bayesian-ude-workflowSkill
- catalyst-reactionsSkill
- continuum-mechanics-and-rheologySkill
- control-theorySkill
- creating-julia-appSkill
- debugging-toolkitSkill
- differential-equationsSkill
- differentiationSkill
- equation-discoverySkill
- experiment-trackingSkill
- fem-feaSkill
- julia-graph-neural-networksSkill
- julia-languageSkill
- julia-ml-and-dlSkill
- julia-model-deploymentSkill
- julia-paper-implementationSkill
- julia-pro-helpSkill
- julia-pro-modeSkill
- julia-reinforcement-learningSkill
- modeling-toolkitSkill
- neural-pdeSkill
- nonlinear-dynamicsSkill
- numerical-methods-implementationSkill
- package-development-workflowSkill
- performance-tuningSkill
- physical-learning-systemsSkill
- playbook-debugSkill
- playbook-model-validateSkill
- playbook-package-releaseSkill
- playbook-paper-implementSkill
- playbook-test-specSkill
- principle-both-sidesSkill
- principle-breakingSkill
- principle-file-is-truthSkill
- principle-gateSkill
- principle-limitsSkill
- principle-loud-failureSkill
- principle-one-stepSkill
- principle-proof-listSkill
- principle-rebuttalSkill
- principle-runtime-surfaceSkill
- principle-three-boundsSkill
- principle-three-clocksSkill
- scientific-visualizationSkill
- sciml-and-diffeqSkill
- setup-julia-proSkill
- signal-processingSkill
- simulation-and-hpcSkill
- statistical-physicsSkill
- symbolic-mathSkill
- web-development-juliaSkill
- zarr-cloud-arraysSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 33
Stop at the first line of the profile that costs more than 20% and that you can explain.
- Very specific: line 51
Put the case into test/benchmarks.jl with BenchmarkTools @benchmarkable and a @ballocated assertion on the hot path, so the next change has …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Make it faster
Six steps. Each closes on a checkable condition; the next one opens on it.
1. Name the clock
Load, compile, or algorithm (principle-three-clocks). Time the same call three times in one fresh process; >10x from call 1 to 2 means compile. Run julia --startup-file=no -e 'using Pkg; @time_imports using MyPkg' when the complaint is "it takes forever to start".
Done when: you can say which clock is slow, with the number that shows it.
2. Baseline
Median of three runs, fresh process, @allocated, Julia version, commit hash, written to a file (principle-both-sides). Warm the function once before timing it, or say that the number includes compilation.
Done when: a file holds the command and the numbers, and re-running the command reproduces them within noise.
3. Localize
| Suspicion | Probe |
| type instability | @code_warntype f(args), look for red Any/Union in the return |
| allocation | @time vs @allocated, then Profile.Allocs.@profile sample_rate=1 f() |
| time distribution | using Profile; @profview f() |
| GC pressure | --track-allocation=user, or GC.enable_logging(true) |
| dispatch cost | @which, @code_lowered, methods(f) ambiguity check |
| BLAS vs generic loop | LinearAlgebra.BLAS.get_config(), check the array is dense and Float64 |
Stop at the first line of the profile that costs more than 20% and that you can explain.
Done when: one function and one mechanism are named ("step! allocates a Vector per call through an untyped field").
4. Change one thing
The usual fixes, in order of payoff: type the struct fields, add a function barrier at the boundary where types become concrete, hoist the allocation out of the loop, use @views and mul!, choose a BLAS or a solver whose complexity matches the problem.
Done when: one diff exists, and you can say which line of the profile it targets.
5. Re-measure
The identical command, a fresh process, same machine. Report the ratio. A ratio inside the noise is reported as no change (principle-both-sides).
Done when: the after-number sits beside the before-number, from the same command.
6. Keep the gain
Put the case into test/benchmarks.jl with BenchmarkTools @benchmarkable and a @ballocated assertion on the hot path, so the next change has a guard. Precompile the workload when the clock was compile (PrecompileTools @compile_workload).
Done when: Pkg.test() runs the benchmark guard, and the proof list (principle-proof-list) records it.
Topics this playbook opens
Load one at the step named. The table exists so you do not read all of them up front.
| Topic | The step that needs it | What it settles |
| performance-tuning | 2 Baseline | which command, which process, and what counts as noise |
| julia-language | 4 Change one thing | type stability and dispatch decide what the hot path allocates |
| differentiation | 4 Change one thing | gradient cost separated from solver cost inside the profiled call |
| symbolic-math | 4 Change one thing | a symbolic Jacobian replacing a closure the loop re-evaluates |
| simulation-and-hpc | 5 Re-measure | a parallel speedup stated against the serial baseline |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

