一键导入
rust-performance
Master Rust performance - profiling, benchmarking, and optimization. Use when optimizing code, reducing allocations, or benchmarking.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Master Rust performance - profiling, benchmarking, and optimization. Use when optimizing code, reducing allocations, or benchmarking.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create or update a release version entry in version.md. Use when drafting a new version, cutting a release, or when the user asks to create or update release notes.
Application overview for frename. Use when: orienting to the project for the first time, deciding which crate or module to touch, understanding what the app does end-to-end, looking up where a concept lives (tags, files, ordering, colors), or understanding keyboard shortcuts and the tag/file lifecycle.
Core development guide for frename-core. Use when: adding or changing traits (StoredTagStore, AppStateStore), modifying TagList logic, working with OrderedCollection, adding Tag fields, changing FileSnapshot/FileTagger, writing core tests, or adding database schema/migrations.
Image preview implementation guide for frename. Use when: adding or changing the media_viewer feature, working with FileKind classification, changing how FolderWorkspace opens files, adding JPEG or HEIC/HEIF decoding, understanding the no-unload path for images, or moving video_player into media_viewer.
UI + core combination guide for frename. Use when: wiring a new feature that spans both UI state and core data, deciding where logic lives (core vs UI), connecting a new message to a core operation, changing how file workspace or folder workspace coordinates with TagList or AppDatabase, or understanding the data flow between a user action and disk write.
Undo/redo implementation guide for frename. Use when: implementing the undo infrastructure in frename-core, adding a new undoable command, wiring Ctrl+Z/Ctrl+Y in the UI, or understanding how History, UndoContext, and commands interact.
| name | rust-performance |
| description | Master Rust performance - profiling, benchmarking, and optimization. Use when optimizing code, reducing allocations, or benchmarking. |
Master performance optimization: profiling, benchmarking, and zero-cost abstractions.
[dev-dependencies]
criterion = { version = "0.5", features = ["html_reports"] }
[[bench]]
name = "my_bench"
harness = false
use criterion::{criterion_group, criterion_main, Criterion, black_box};
fn benchmark(c: &mut Criterion) {
c.bench_function("fib", |b| {
b.iter(|| fibonacci(black_box(20)))
});
}
criterion_group!(benches, benchmark);
criterion_main!(benches);
cargo install flamegraph
cargo flamegraph --bin my-app
// Bad: Allocates each iteration
for s in strings {
result = result + &s;
}
// Good: Pre-allocate
let mut result = String::with_capacity(total_len);
for s in strings {
result.push_str(&s);
}
// Bad: Intermediate collection
let v: Vec<_> = data.iter().map(|x| x * 2).collect();
let sum: i32 = v.iter().sum();
// Good: Lazy chain
let sum: i32 = data.iter().map(|x| x * 2).sum();
use std::borrow::Cow;
fn process(input: &str) -> Cow<str> {
if input.contains("bad") {
Cow::Owned(input.replace("bad", "good"))
} else {
Cow::Borrowed(input)
}
}
[profile.release]
lto = true
codegen-units = 1
opt-level = 3
| Problem | Solution |
|---|---|
| Slow debug | Use --release |
| Memory spikes | Use streaming |
| Cache misses | Improve data layout |