Skip to content
Agentmart
Submit a tool

rust-perf

Rust performance and memory optimization for Skill Doctor L1.

Skill by KalarisLabs

IndexedApache-2.0★ 13
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/kalarislabs-rust-perf

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

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).

Use cases: writing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/rust-perf

What's inside

Skill name
rust-perf
Description
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).
License
Apache-2.0
Instructions
67 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# 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)

1. **Do not compile YARA at scan time.** `build.rs` once. Scan = match.
2. **mmap** skill files with `memmap2` when size > ~64 KiB. Keep small files on the stack/heap.
3. **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`.
4. **Rayon over files and engines**, not over lines inside one 2 KB SKILL.md.
5. **Sorted walk once.** Determinism and perf: `ignore`/`walkdir` → collect → `sort` → process.
6. **Canonical digest** over sorted `(path, content)` pairs; hash streaming, not a giant concatenated `String`.
7. **No tokio, no async, no reqwest** on the default path. Async startup cost kills cold-install.
8. **Binary size:** default features slim. `LTO=thin` in release profile. `strip = true`. Avoid `tokio`+`reqwest`+`openssl` in the default binary (use rustls only if L4 is on). Target ~12 MB **stripped musl**.
9. **RSS:** do not hold every file's bytes after L1 on that file finishes. Drop mmaps per file. Global caches are digest → findings, bounded.
10. **Ruleset** is embedded bytes, not a temp directory of `.yar` files at runtime.

## Forbidden “optimizations”

- Skipping Unicode/SD-11 work on the L2 path to go faster (L2 is optional; L1 unicode still runs).
- Unordered `HashMap` iteration in reports (breaks determinism). Use `BTreeMap` or sort before serialize.
- `parallel` + unsynchronized `Vec::push`.
- Adding an LLM “to filter false positives” on the hot path.
- `cargo build --release` numbers copied into the paper. Paper values stay **targets** until RESULTS.md.

## How to measure

```bash
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 * 60
```

Prefer `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)

```toml
[profile.release]
lto = "thin"
codegen-units = 1
opt-level = 3
strip = true
panic = "abort"   # binary only; libraries stay unwind if tests need it
```

Use `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.

From KalarisLabs/Skill-Doctor, Apache-2.0.

More from KalarisLabs/Skill-Doctor

Signals

Stars
13
Forks
1
Open issues
30
Last commit (this folder)
Sep 10, 2026 (1 month ago)
Last release
Sep 12, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from KalarisLabs

Cite this page

rust-perf skill. Agent Mart. https://agentmart.dev/skills/kalarislabs-rust-perf (last updated 2026-10-24)