agentleFS
90184479018447/julia-pro-p/skills/playbook-perf/SKILL.md

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.

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
  1. Distinctive:

    Stop at the first line of the profile that costs more than 20% and that you can explain.

    line 33
  2. Very specific:

    Put the case into test/benchmarks.jl with BenchmarkTools @benchmarkable and a @ballocated assertion on the hot path, so the next change has …

    line 51

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

SuspicionProbe
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 distributionusing 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 loopLinearAlgebra.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.

TopicThe step that needs itWhat it settles
performance-tuning2 Baselinewhich command, which process, and what counts as noise
julia-language4 Change one thingtype stability and dispatch decide what the hot path allocates
differentiation4 Change one thinggradient cost separated from solver cost inside the profiled call
symbolic-math4 Change one thinga symbolic Jacobian replacing a closure the loop re-evaluates
simulation-and-hpc5 Re-measurea parallel speedup stated against the serial baseline

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.