smithery/neversight

rust-performance

Master Rust performance - profiling, benchmarking, and optimization

Installation

$ npx skills add smithery/neversight --skill rust-performance

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/neversight · top by installs.

npx skills add smithery/neversight

Browse all from smithery/neversight

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.0.0

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,969 B
  • docs SUMMARY.md 91 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Rust Performance Skill

Master performance optimization: profiling, benchmarking, and zero-cost abstractions.

Quick Start

Benchmarking

[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);

Profiling

cargo install flamegraph
cargo flamegraph --bin my-app

Optimization Patterns

Avoid Allocations

// ❌ Allocates each iteration
for s in strings {
    result = result + &s;
}

// ✅ Pre-allocate
let mut result = String::with_capacity(total_len);
for s in strings {
    result.push_str(&s);
}

Use Iterators

// ❌ Intermediate collection
let v: Vec<_> = data.iter().map(|x| x * 2).collect();
let sum: i32 = v.iter().sum();

// ✅ Lazy chain
let sum: i32 = data.iter().map(|x| x * 2).sum();

Cow for Optional Clone

use std::borrow::Cow;

fn process(input: &str) -> Cow<str> {
    if input.contains("bad") {
        Cow::Owned(input.replace("bad", "good"))
    } else {
        Cow::Borrowed(input)
    }
}

Release Profile

[profile.release]
lto = true
codegen-units = 1
opt-level = 3

Troubleshooting

Problem Solution
Slow debug Use --release
Memory spikes Use streaming
Cache misses Improve data layout

Resources