スキル一覧に戻る
vanyastaff

rust-performance-analyzer

by vanyastaff

0🍴 0📅 2026年1月8日
GitHubで見るManusで実行

SKILL.md


name: rust-performance-analyzer description: Analyzes Rust code for performance bottlenecks, memory inefficiencies, and optimization opportunities. Use when discussing performance, slow code, memory usage, profiling, benchmarks, or optimization.

Rust Performance Analyzer

Expert skill for analyzing and optimizing Rust application performance.

When to Use

Activate this skill when the user:

  • Mentions "slow", "performance", "optimize", "bottleneck"
  • Asks about memory usage or allocation patterns
  • Wants to profile or benchmark code
  • Reports laggy UI or frame drops
  • Discusses cache efficiency or data layout

Analysis Process

1. Identify Hot Paths

Look for:

  • Frequent allocations (Vec::new(), String::new() in loops)
  • Unnecessary cloning (.clone() where borrow would work)
  • Hash map lookups in tight loops
  • Box/Arc indirection overhead

2. Memory Layout Analysis

Check:

  • Struct field ordering (largest first for alignment)
  • Use of #[repr(C)] where needed
  • Option niche optimization usage
  • Cache line friendliness

3. Concurrency Patterns

Evaluate:

  • Lock contention (Mutex, RwLock usage)
  • parking_lot vs std sync primitives
  • Atomic operations appropriateness
  • Send/Sync bounds efficiency

4. FLUI-Specific Patterns

Focus on:

  • Signal update frequency
  • Rebuild triggering patterns
  • Layout phase efficiency
  • Paint layer caching

Optimization Techniques

Allocation Reduction

// Bad: Allocates on every call
fn process(items: &[Item]) -> Vec<ProcessedItem> {
    items.iter().map(|i| process_one(i)).collect()
}

// Good: Reuse buffer
fn process_into(items: &[Item], buffer: &mut Vec<ProcessedItem>) {
    buffer.clear();
    buffer.extend(items.iter().map(|i| process_one(i)));
}

Clone Elimination

// Bad: Unnecessary clone
let data = self.data.clone();
process(&data);

// Good: Borrow directly
process(&self.data);

Interior Mutability

// Use RefCell/Cell for single-threaded
// Use parking_lot::{Mutex, RwLock} for multi-threaded
// Use atomics for simple counters/flags

Profiling Commands

# Build with debug symbols
cargo build --release

# CPU profiling (requires cargo-flamegraph)
cargo flamegraph --example <name>

# Memory profiling
RUSTFLAGS="-Z sanitizer=address" cargo +nightly run --example <name>

# Benchmarking
cargo bench

Output Format

Provide:

  1. Identified Issues: List of performance problems found
  2. Impact Assessment: Severity (High/Medium/Low)
  3. Optimization Suggestions: Specific code changes
  4. Metrics: Before/after estimates where possible

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です