rust-performance
Skill1 starsChanged 5 days agoMITView on GitHub
Measure, profile, optimize, and regression-test Rust performance across latency, throughput, CPU, allocations, memory, binary size, and compile time using representative workloads, Criterion, iai-callgrind, cargo-flamegraph, samply, DHAT, heap or pprof tools, cargo-bloat, cargo-llvm-lines, and build timings. Use when users report slow Rust code, high memory or CPU, large binaries, noisy benchmarks, tail-latency regressions, or need performance budgets and evidence-backed optimization.
12 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- rewrite-rs/skillstheir own version, first seen Nov 29, 2026
- Dankosik/cargo-modernizetheir own version, first seen Nov 29, 2026
- gurinderu/crafttheir own version, first seen Nov 29, 2026
- zevarix/rust-coding-standardstheir own version, first seen Nov 29, 2026
- Lu1sDV/skillsmdtheir own version, first seen Nov 27, 2026
- po4yka/rust-skillstheir own version, first seen Nov 2, 2026
Used with
Projects with it also use rust-errors, rust-macros and 6 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
dawidpereiraSkillrust-errors
Rust error handling patterns with Result, Option, thiserror, and anyhow. Use whenever implementing error types, adding error propagation with ?, choosing between panic and Result, or working with .unwrap()/.expect(). Covers library vs application error strategy, error chaining, context, and custom error types. Also use when seeing unwrap abuse or unclear error propagation in code review.
Also in 4 projects that use this
dawidpereiraSkillrust-macros
Rust macros — macro_rules!, proc macros, derive macros, attribute macros, fragment specifiers, repetition, hygiene, cargo expand, when to use macros vs generics. Use when writing or debugging declarative or procedural macros, choosing between macros and other abstractions, understanding expansion errors, or generating repetitive code.
Also in 5 projects that use this
adxptivedSkillrust-security
Rust application security, supply-chain hardening, cryptography hygiene, secrets handling, and secure service patterns. Use when: - User asks about secure Rust code, threat modeling, auth, tokens, password hashing, or secrets - User uses crates like argon2, password-hash, ring, rustls, secrecy, zeroize, jsonwebtoken, or biscuit - User handles untrusted input, file paths, uploads, subprocesses, deserialization, or SSRF-prone URLs - User wants cargo audit, cargo deny, dependency policy, SBOMs, or supply-chain checks - User writes unsafe code exposed to untrusted data or FFI boundaries - User builds web APIs that need TLS, CORS, cookies, sessions, CSRF, rate limits, or tenant isolation - User implements OAuth2/OIDC, API key validation, JWT verification, or mTLS
Also in 4 projects that use this
botirkhaltaevSkillrust-unsafe-ffi
Master unsafe Rust, FFI, and foreign function interface programming. Use when writing unsafe Rust code with raw pointers, interfacing with C/C++ libraries, creating bindings with bindgen, implementing zero-cost abstractions, working with uninitialized memory, or understanding the safety/unsafety boundary.
Also in 3 projects that use this
adxptivedSkillrust-api-design
Rust API Design guidelines, naming conventions, and best practices. Use when: - User is designing a library, crate, or public APIs - Implementing patterns like Builder, Typestate, or Extension traits - Designing public structures, enums, or traits - Working with common traits (From/Into, Default, AsRef, Debug, Clone) - Applying #[must_use] or #[non_exhaustive] attributes - Restricting trait implementation via Sealed Traits - Formatting naming structures and lifetime designs
Also in 4 projects that use this
DankosikSkillrust-debugging
Causality. Use for an uncertain Rust CLI defect, panic, hang, incorrect output, resource leak, or platform-dependent failure.
Also in 3 projects that use this
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- full-stack-skills/rust-skills★ 894% same
Wrote their own version · 11
- huiali/rust-skills★ 47same name
- rewrite-rs/skills★ 32same name
- po4yka/rust-skills★ 7same name
- botirkhaltaev/botir-skills★ 4same name
- jscott3201/yet-more-skills★ 4same name
- Lu1sDV/skillsmd★ 2same name
- zevarix/rust-coding-standards★ 2same name
- adxptived/Rust-Skills★ 1same name
- gurinderu/craft★ 1same name
- Dankosik/cargo-modernize★ 0same name
1 more not listed
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 repository16 other files it gives its agents.
- accessibilitySkill
- cargo-fuzzSkill
- core-web-vitalsSkill
- impeccableSkill
- property-based-testingSkill
- rust-best-practicesSkill
- rust-cargo-buildSkill
- rust-cliSkill
- rust-concurrencySkill
- rust-databaseSkill
- rust-http-clientSkill
- rust-testingSkill
- rust-web-securitySkill
- rust-webSkill
- sonjoo-auditSkill
- sonjoo-auditSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 10 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Use this skill for microbenchmarks, end-to-end load tests, CPU profiles, allocation and heap analysis, binary size, compile time, cache …
- Distinctive: line 20
Use rust-concurrency for concurrency semantics, rust-testing for test architecture, rust-cargo-build for release profiles and features, and
- Distinctive: line 28
Do not optimize debug builds or synthetic inputs unless they represent the actual problem.
- Distinctive: line 32
Verify correctness before benchmarking.
- Distinctive: line 33
Use release-like optimization, codegen units, LTO, panic strategy, and target CPU settings intentionally.
- Distinctive: line 38
Read Benchmarking and Regression Gates.
- Distinctive: line 62
Do not use unsafe, custom allocators, SIMD, lock-free structures, or caching until simpler changes are insufficient and invariants plus …
- Distinctive: line 79
Add a stable regression check or explain why the environment is too noisy.
“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rust Performance
Optimize from evidence. Define the user-visible metric, reproduce the workload, establish a stable baseline, profile the dominant cost, change one cause, and prove both correctness and improvement.
Scope and Routing
Use this skill for microbenchmarks, end-to-end load tests, CPU profiles, allocation and heap analysis, binary size, compile time, cache behavior, and regression budgets.
Use rust-concurrency for concurrency semantics, rust-testing for test architecture, rust-cargo-build for release profiles and features, and rust-best-practices for code review.
Workflow
1. Define the performance contract
Record the workload, dataset, inputs, concurrency, platform, CPU and memory limits, toolchain, target, features, allocator, build profile, warm-up, cache state, and success metrics. Distinguish throughput from p50/p95/p99 latency and steady-state from startup or shutdown.
Do not optimize debug builds or synthetic inputs unless they represent the actual problem.
2. Establish a reproducible baseline
- Verify correctness before benchmarking.
- Use release-like optimization, codegen units, LTO, panic strategy, and target CPU settings intentionally.
- Isolate background load, power management, thermal throttling, and noisy shared runners.
- Record raw samples and uncertainty, not only one average.
- Compare the same commit, toolchain, dependency graph, and hardware when enforcing small regressions.
Read Benchmarking and Regression Gates.
3. Choose the measurement layer
| Question | Tool or evidence |
| Is a pure operation faster? | Criterion or Divan microbenchmark |
| Did instruction-level cost change? | iai-callgrind on supported systems |
| Where is CPU time spent? | samply, cargo-flamegraph, Instruments, perf, pprof |
| Where are allocations retained? | DHAT, heap profiler, allocator metrics |
| Why is the binary large? | cargo-bloat and feature inspection |
| What drives compile time? | Cargo build timings and cargo-llvm-lines |
| Does the service meet its SLO? | Representative load test plus observability |
A microbenchmark does not prove end-to-end latency, overload behavior, or memory bounds.
4. Profile before editing
Capture a profile under the failing workload. Preserve symbols and use the same optimized artifact intended for comparison. Separate on-CPU work, waiting, lock contention, I/O, allocation, page faults, and scheduler overhead. Read CPU and Latency Profiling.
5. Optimize the dominant cause
Common changes include algorithmic complexity, fewer passes, better batching, avoiding repeated parsing or allocation, borrowing instead of cloning, data-layout improvements, reduced synchronization, bounded queues, streaming, feature reduction, and moving CPU work off async workers.
Do not use unsafe, custom allocators, SIMD, lock-free structures, or caching until simpler changes are insufficient and invariants plus fallback behavior are tested.
6. Measure memory, size, and build cost
Track peak RSS, retained heap, allocation rate, fragmentation, cache growth, buffer bounds, binary sections, monomorphization, debug information, enabled features, macro expansion, and incremental versus clean compile time. Read Memory, Binary Size, and Compile Time.
7. Prove the result
Rerun correctness tests and the exact baseline protocol. Report absolute and relative results, variance, hardware and software context, tradeoffs, and regressions in secondary metrics. Add a durable benchmark or budget only when the environment can detect the intended threshold reliably.
Completion Criteria
- Define a representative workload and user-visible metric.
- Record reproducible baseline evidence before optimization.
- Profile and identify the dominant cost rather than guessing.
- Preserve correctness and safety through targeted tests.
- Re-measure under the same protocol and report uncertainty plus tradeoffs.
- Add a stable regression check or explain why the environment is too noisy.
Resources
- Benchmarking and Regression Gates
- CPU and Latency Profiling
- Memory, Binary Size, and Compile Time
- Optimization Workflow
- Execution Scenarios
examples/golden-performance/: a compiled Criterion benchmark target.
Upstream Sources
Data Privacy
This skill does not collect, store, or transmit user data. Profiles, heap dumps, command lines, symbols, and benchmark datasets may contain sensitive information; confirm storage and upload policy before sharing them.
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.

