rust-performance
Profile and optimize Rust CPU, memory, I/O, async, and build performance with representative benchmarks.
Skill by caarlos0
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/caarlos0-rust-performance
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.
About
Reviews
Write a reviewNo 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-performance
What's inside
- Skill name
rust-performance- Description
- Profile and optimize Rust CPU, memory, I/O, async, and build performance with representative benchmarks.
- License
- MIT
- Instructions
- 113 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Rust Performance Profile first, then change one measured bottleneck. Report the workload, tool, target, toolchain, build profile, and before/after values. ## Measure Rust, not debug builds Use optimized code with symbols: ```toml [profile.profiling] inherits = "release" debug = "line-tables-only" ``` Use Criterion for microbenchmarks and `std::hint::black_box` only where the compiler could fold inputs or remove results. For CPU profiles use the repository's profiler, `samply`, `perf`, Instruments, or `cargo flamegraph`. Use DHAT or an allocation profiler when CPU samples point to allocation. ## Allocations and ownership - Pre-size known growth with `Vec::with_capacity`, `String::with_capacity`, and `HashMap::with_capacity`. - Use `clone_from` when replacing an existing value can reuse its allocation. - Use `Cow` at boundaries where most callers borrow and few need ownership. Do not spread it through APIs without evidence; it adds branching and type complexity. - `SmallVec` and other inline collections help only when the observed length distribution usually fits inline. Their inline storage increases value and stack size. - Inspect hot type sizes with `size_of`, `-Zprint-type-sizes`, or a type-size tool. Box a rare large enum variant only when shrinking the common value improves the workload. - Reuse buffers across iterations when ownership is clear. Do not pool small values whose allocation is not visible in a profile. For maps, use the entry API to avoid duplicate lookups and reserve capacity when the size is known. Alternative hashers trade collision resistance, dependencies, and portability for throughput; use them only for trusted keys after representative key-distribution benchmarks. ## Iterators, strings, and bytes - Implement an accurate `size_hint` for custom iterators consumed by `collect` or `extend`. - Avoid `collect` when the result is immediately iterated once; keep the chain lazy. Collect when ownership, sorting, indexing, or reuse requires it. - Prefer iterating slices to repeated indexing in hot loops; this often makes bounds-check elimination easier. - Reuse `String`, `Vec<u8>`, or `bytes::BytesMut` buffers instead of formatting or allocating per item. Work with `&[u8]` for genuinely byte-oriented data; do not discard Unicode or path semantics for speed. - Keep `Path`/`OsStr` values native. Avoid string conversion solely for comparison or joining. ## I/O Use `BufReader`/`BufWriter` for repeated small operations and choose capacity from observed request sizes. Batch writes and reuse read buffers. Preserve partial-write handling, flush errors, EOF behavior, and output ordering; a faster path that changes them is incorrect. ## Async and concurrency - Never perform long CPU work, blocking syscalls, or synchronous sleeps on an async executor thread. Use `spawn_blocking` for bounded blocking work and Rayon or a dedicated pool for sustained CPU parallelism. - Prefer `std::sync::Mutex` when the guard never crosses `.await`; use an async mutex only when it must. Profile contention before replacing either. - Use bounded channels when producers can outrun consumers. Select `mpsc`, `oneshot`, `watch`, or `broadcast` from message semantics, not benchmark folklore. - Audit cancellation and losing `select!` branches before batching or buffering. Work discarded on cancellation is still cost. - Account for oversubscription when Tokio blocking threads, Rayon, native libraries, and application threads share the same CPUs. - Check task ownership, queue depth, and shutdown. Leaked tasks and unbounded queues commonly look like memory or latency regressions. Invoke `runtime-process-debugging` for process, pipe, EOF, child-lifecycle, or shutdown stalls. ## Build and low-level tuning Benchmark `lto`, `codegen-units`, `opt-level`, panic strategy, allocator, PGO, and linker changes separately. `target-cpu=native` is valid only for fixed deployment hardware; it makes distributed artifacts non-portable. Before adding SIMD or `unsafe`, verify the hot instruction sequence and whether the compiler already removed bounds checks or vectorized it. Prefer safe loop shapes first. Every `unsafe` optimization needs a precise invariant, tests that exercise it, and a measured win over the safe version. ## Regression guards Use a focused Criterion benchmark, allocation guard, or compile-time size assertion only for the invariant that matters. Keep wall-time on shared CI advisory unless hardware and variance are controlled. Pin the Rust toolchain when compiler code generation affects the comparison. ## Related skills - `rust-specialist` takes precedence for correctness, safety, and API design. - `my-code-review` checks a completed diff. When invoked from `my-code-review`, do not invoke it again. - `code-simplifier` runs after the gain is proven and preserves measured behavior. - `runtime-process-debugging` owns process and lifecycle stalls. Correctness and safety override performance.
From caarlos0/dotfiles, MIT.
More from caarlos0/dotfiles
- 0.794score
apple-developer
caarlos0
Build, debug, and review native macOS, iPadOS, and iOS apps.
SkillAFreshness: A★ 224Claude Code +9 - 0.792score
cli-design
caarlos0
Design and review command-line interfaces for usability, automation, safety, accessibility, and long-term compatibility.
SkillAFreshness: A★ 224Claude Code +9 - 0.792score
writing-tests
caarlos0
Write deterministic tests that fail for real product defects.
SkillAFreshness: A★ 224Claude Code +9 - 0.792score
dashboard
caarlos0
Design and review dashboards that are informative, honest, accessible, and visually polished, independent of any tool.
SkillAFreshness: A★ 224Claude Code +9 - 0.792score
gh-cli
caarlos0
Use GitHub CLI efficiently for pull requests, CI checks, workflow runs, logs, and merge status.
SkillAFreshness: A★ 224Claude Code +9 - 0.792score
gh-doc-author
caarlos0
Author and revise clear GitHub internal documentation, including design docs, proposals, decision records, runbooks, status updates, and handoffs.
SkillAFreshness: A★ 224Claude Code +9 - 0.792score
go-conventions
caarlos0
Carlos Becker's Go implementation and review conventions.
SkillAFreshness: A★ 224Claude Code +9 - 0.792score
tui-design
caarlos0
Design terminal user interfaces and interactive CLIs that stay usable, accessible, and scriptable.
SkillAFreshness: A★ 224Claude Code +9 - 0.788score
code-simplifier
caarlos0
Final simplification pass over recently changed code without changing behavior.
SkillAFreshness: A★ 224Claude Code +9 - 0.788score
dependabot-merge
caarlos0
Review and merge open dependency pull requests from Dependabot, Renovate and similar bots across the goreleaser organization and the caarlos0 user.
SkillAFreshness: A★ 224Claude Code +9 - 0.788score
rust-specialist
caarlos0
Rust specialist for implementation, review, refactoring, safety, cross-platform behavior, async/process lifecycles, and measured performance.
SkillAFreshness: A★ 224Claude Code +9 - 0.788score
my-code-review
caarlos0
Review code, diffs, branches, commits, and pull requests for correctness, tests, simplicity, performance, and usability.
SkillAFreshness: A★ 224Claude Code +9
Compare and alternatives
Featured in
Signals
- Stars
- 224
- Forks
- 12
- Open issues
- 0
- Last commit (this folder)
- Oct 20, 2026 (7 days ago)
- Last release
- Oct 1, 2026 (26 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/caarlos0/dotfiles
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from caarlos0
- 0.794score
apple-developer
caarlos0
Build, debug, and review native macOS, iPadOS, and iOS apps.
SkillAFreshness: A★ 224Claude Code +9 - 0.792score
gh-doc-author
caarlos0
Author and revise clear GitHub internal documentation, including design docs, proposals, decision records, runbooks, status updates, and handoffs.
SkillAFreshness: A★ 224Claude Code +9 - 0.792score
gh-cli
caarlos0
Use GitHub CLI efficiently for pull requests, CI checks, workflow runs, logs, and merge status.
SkillAFreshness: A★ 224Claude Code +9 - 0.792score
dashboard
caarlos0
Design and review dashboards that are informative, honest, accessible, and visually polished, independent of any tool.
SkillAFreshness: A★ 224Claude Code +9 - 0.792score
cli-design
caarlos0
Design and review command-line interfaces for usability, automation, safety, accessibility, and long-term compatibility.
SkillAFreshness: A★ 224Claude Code +9 - 0.792score
go-conventions
caarlos0
Carlos Becker's Go implementation and review conventions.
SkillAFreshness: A★ 224Claude Code +9
Cite this page
rust-performance skill. Agent Mart. https://agentmart.dev/skills/caarlos0-rust-performance (last updated 2026-10-24)