rust-perf
Skill13 starsChanged 3 months agoApache-2.0View on GitHub
Rust performance and memory optimization for Skill Doctor L1. Use when making scans faster, reducing RSS or binary size, adding rayon/mmap, writing benchmarks, or discussing the §7.3 targets (2000 skills/min, 40MB, 12MB binary, 15s cold).
2 other projects use a version of this.
Adopted by
Most recently taken up by
- decebal/curated-claude-skillstheir own version, first seen May 29, 2026
- dawidpereira/rust-skillstheir own version, first seen Mar 22, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- dawidpereira/rust-skills★ 0same name
- decebal/curated-claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository31 other files it gives its agents.
- AGENTS.mdAGENTS.md
- paper-writingSkill
- research-surveySkill
- brainstormingSkill
- ci-cdSkill
- cli-sarifSkill
- dispatching-parallel-agentsSkill
- executing-plansSkill
- finishing-a-development-branchSkill
- neutralize-sd11Skill
- project-contextSkill
- receiving-code-reviewSkill
- release-publishSkill
- requesting-code-reviewSkill
- review-botsSkill
- rust-best-practicesSkill
- rust-idiomsSkill
- rust-invariantsSkill
- rust-skillsSkill
- rust-testingSkill
- rust-workspaceSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- unsafe-sandboxSkill
- using-git-worktreesSkill
- using-superpowersSkill
- verification-before-completionSkill
- writing-plansSkill
- writing-skillsSkill
- yara-rulesSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are 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.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Treat these as the optimization budget.
- Very specific: line 32
Binary size: default features slim. LTO=thin in release profile.
- Distinctive: line 33
RSS: do not hold every file's bytes after L1 on that file finishes.
- Very specific: line 66
Use panic = "abort" only on the binary package via [profile.release.package.skill-doctor] if tests need unwind.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Rust performance
Load this before optimizing. Do not sacrifice invariants (determinism, additive-only, no mandatory LLM) for speed.
Pre-registered targets (§7.3) — not measured results
Treat these as the optimization budget. Write them into benches as assert ceilings once harness exists. Until then, design so they are reachable. Never publish a number as measured unless sd-bench/RESULTS.md was produced by the harness on a tagged release.
| Metric | Target |
| Throughput (offline L1, warm cache off) | ≥ 2,000 skills/min |
| Peak RSS | < 40 MB |
| Install | one binary, ~12 MB, zero runtime deps |
| Cold install → first result | < 15 s |
Parity with Cisco/NVIDIA on synthetic TPR is the detection claim; adoption is this table. Competitors cannot move install footprint without leaving Python.
What to optimize (in order)
- Do not compile YARA at scan time.
build.rsonce. Scan = match. - mmap skill files with
memmap2when size > ~64 KiB. Keep small files on the stack/heap. - Zero extra alloc on the miss path. A clean skill should not build a
Vec<Finding>of zeros then throw it away — return empty slice /SmallVec. - Rayon over files and engines, not over lines inside one 2 KB SKILL.md.
- Sorted walk once. Determinism and perf:
ignore/walkdir→ collect →sort→ process. - Canonical digest over sorted
(path, content)pairs; hash streaming, not a giant concatenatedString. - No tokio, no async, no reqwest on the default path. Async startup cost kills cold-install.
- Binary size: default features slim.
LTO=thinin release profile.strip = true. Avoidtokio+reqwest+opensslin the default binary (use rustls only if L4 is on). Target ~12 MB stripped musl. - RSS: do not hold every file's bytes after L1 on that file finishes. Drop mmaps per file. Global caches are digest → findings, bounded.
- Ruleset is embedded bytes, not a temp directory of
.yarfiles at runtime.
Forbidden “optimizations”
- Skipping Unicode/SD-11 work on the L2 path to go faster (L2 is optional; L1 unicode still runs).
- Unordered
HashMapiteration in reports (breaks determinism). UseBTreeMapor sort before serialize. parallel+ unsynchronizedVec::push.- Adding an LLM “to filter false positives” on the hot path.
cargo build --releasenumbers copied into the paper. Paper values stay targets until RESULTS.md.
How to measure
cargo build -p skill-doctor --release
/usr/bin/time -v ./target/release/skill-doctor scan-all ./tests/fixtures --offline --deterministic
# RSS = Maximum resident set size
# Throughput = fixtures / wall time * 60Prefer criterion or a fixed benches/ once the scan path exists. Pin fixture counts. Do not use std::time in unit tests as a pass/fail speed gate (too noisy on CI). Put performance gates in sd-bench or a dedicated perf.yml nightly job, not in the every-commit clippy job.
Release profile (root Cargo.toml)
[profile.release]
lto = "thin"
codegen-units = 1
opt-level = 3
strip = true
panic = "abort" # binary only; libraries stay unwind if tests need itUse panic = "abort" only on the binary package via [profile.release.package.skill-doctor] if tests need unwind.
Mental model
Cold install < 15 s means: static musl binary on PATH, no pip, no model pull, no rule compile, first scan of a small skill is dominated by process start + mmap + YARA match. If you add a runtime that downloads models or compiles rules, you have missed the target on purpose.
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.

