Przejdź do treści
Biblioteka skilli
Programowanie · Analiza

rust-performance

/rust-performance

Mierzy i profiluje Rust pod kątem opóźnień, CPU, pamięci i rozmiaru binarki, z benchmarkami Criterion, DHAT i testami regresji.

Repozytorium
rust-skills ↗
Licencja
Apache-2.0
Ostatnia zmiana repozytorium
24.09.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
11
Skrypty
2
Komentarze HTML
0
Adresy URL w SKILL.md
6
Przestarzałość

Brak sygnałów. Repozytorium zmienione 24.09.2026, bez odwołań do wycofanych modeli i API.

Licencja

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co sprawdzić przed instalacją
  • 2 skrypty w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.

Skrypty: examples/golden-performance/benches/sum.rs, examples/golden-performance/src/lib.rs

Co robi i kiedy

Mierzy i profiluje Rust pod kątem opóźnień, CPU, pamięci i rozmiaru binarki, z benchmarkami Criterion, DHAT i testami regresji.

Oryginalny opis (EN)

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.

Jak działa

  1. Scope and Routing
  2. Workflow
  3. Completion Criteria
  4. Resources
  5. Upstream Sources
  6. Data Privacy
Sekcje z nagłówków SKILL.md, w oryginale · 92 linii, 651 słów
Podgląd SKILL.md
---
name: rust-performance
license: Apache-2.0
description: 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.
---

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

Route concurrency semantics to `rust-concurrency`, telemetry pipelines to `rust-observability`, general test architecture to `rust-testing`, release profiles and features to `rust-cargo-build`, and semantic review to `rust-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](references/benchmarking-and-regressions.md).

### 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](references/cpu-and-latency-profiling.md).

### 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](references/memory-size-and-compile-time.md).

### 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](references/benchmarking-and-regressions.md)
- [CPU and Latency Profiling](references/cpu-and-latency-profiling.md)
- [Memory, Binary Size, and Compile Time](references/memory-size-and-compile-time.md)
- [Optimization Workflow](references/optimization-workflow.md)
- [Execution Scenarios](examples/examples.md)
- `examples/golden-performance/`: a compiled Criterion benchmark target.

## Upstream Sources

- [Criterion.rs](https://criterion-rs.github.io/criterion.rs/book/)
- [iai-callgrind](https://docs.rs/iai-callgrind/)
- [cargo-flamegraph](https://github.com/flamegraph-rs/flamegraph)
- [samply](https://github.com/mstange/samply)
- [cargo-bloat](https://github.com/RazrFalcon/cargo-bloat)
- [Cargo build timings](https://doc.rust-lang.org/cargo/reference/timings.html)

## 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.
Pliki w paczce (11)
  • SKILL.md 6 KB
  • agents/openai.yaml 1 KB
  • examples/examples.md 1 KB
  • examples/golden-performance/Cargo.lock 17 KB
  • examples/golden-performance/Cargo.toml 1 KB
  • examples/golden-performance/benches/sum.rs 1 KB
  • examples/golden-performance/src/lib.rs 1 KB
  • references/benchmarking-and-regressions.md 2 KB
  • references/cpu-and-latency-profiling.md 1 KB
  • references/memory-size-and-compile-time.md 1 KB
  • references/optimization-workflow.md 1 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · full-stack-skills/rust-skills100Apache-2.0
rewrite-rs/skills100BSD-3-Clause
heyAyushh/stacc95MIT

Migawka bazy z 13.11.2026 · wersja paczki 3de96ed481a5 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100rust-profiling
    Pomaga profilować binaria Rust przez flamegraphy, cargo-bloat, cargo-llvm-lines, Criterion, perf, heaptrack i DHAT.
  • 100rust-profiling
    Generuje flamegraphy z binarek Rust, mierzy rozrost monomorfizacji i rozmiar binarki oraz prowadzi mikrobenchmarki Criterion.
  • 95rust-optimization
    Optymalizuje wydajność Rust: benchmarki, profilowanie, profil release, alokacje, współbieżność, asynchroniczność i rozmiar binarki.
  • 95rust-optimizer
    Audytuje projekty w Rust pod kątem szybkości, pamięci i rozmiaru, mierzy wyniki przed i po, a zmiany wdraża po akceptacji planu.
  • 100performance-profiling
    Znajduje i naprawia problemy wydajności backendu: mierzy p95 i p99, profiluje CPU, pamięć, I/O i blokady, a po poprawce dodaje test regresji.
  • 100performance-expert
    Optymalizuje wydajność procesora, pamięci, I/O i renderowania metodą zaczynającą od pomiaru: profilowanie, wycieki pamięci, N+1, cache i flamegraph.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.