perf-loop

Optimizes Rust code through a disciplined measure-hypothesize-change-remeasure performance loop.

218|11|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/baseballyama/rsvelte --skill perf-loop-baseballyama
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: perf-loop
Source: https://github.com/baseballyama/rsvelte/tree/main/.claude/skills/perf-loop
Command: npx skills add https://github.com/baseballyama/rsvelte --skill perf-loop-baseballyama

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Rust performance work often fails because developers optimize without baselines, mix multiple changes into one measurement, or chase cold code. This Skill enforces a strict profiling discipline so every optimization is measured, isolated, and reversible. ## Core Features & Use Cases - Structured optimization loop: Enforces baseline → profile → hypothesis → single change → test → remeasure, with explicit stop conditions and revert rules. - Toolchain guidance: Covers hyperfine, criterion, samply, dhat, perf stat, and cargo asm, plus Cargo profile configuration (release, profiling, bench, dist) and PGO workflows. - Ranked optimization playbook: Orders techniques by expected impact, from algorithmic changes and allocation reduction (arena, SmallVec, Cow) through layout, hashing, micro-optimizations, and parallelism. - Use Case: A developer profiling the rsvelte Svelte compiler uses the Skill to identify hot functions with samply, replace serde_json::Value with typed AST nodes, and verify each change with perf_bench before committing. ## Quick Start Ask the assistant to profile the Rust project and run one measured optimization iteration on the hottest function.

Frequently Asked Questions about perf-loop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I profile Rust code to find performance bottlenecks?▼

Use samply for CPU sampling as the first choice, criterion for function-level benchmarks, and hyperfine for end-to-end timing with at least ten runs. Build with a profiling profile that keeps line-table debug info and frame pointers enabled.

What is the correct workflow for Rust performance optimization?▼

Take a baseline measurement first, form an explicit hypothesis with an expected percentage gain, make exactly one change, run tests, then remeasure under identical conditions. Revert anything under five percent improvement since that range is noise.

Which Rust optimization techniques give the biggest speedups?▼

Algorithmic and structural changes give the largest wins, followed by allocation reduction using arenas, Cow, SmallVec, and with_capacity. Hash map swaps like FxHashMap give 1.2-2x, while micro-optimizations like inline hints typically yield only 5-30 percent.

Why do my Rust benchmark results vary between runs?▼

Background processes like mds_stores can consume CPU during measurement windows, and wall-clock time fluctuates with system load. Use CPU time instead of wall time, run A/B comparisons back-to-back in alternating order, and check for competing processes first.

When should I stop optimizing a Rust codebase?▼

Stop when you have addressed the top five profiled functions and hit 80 percent of your target, when remaining hot functions each account for under five percent, or when three consecutive iterations produce less than one percent movement.