rust-performance-engineer

rust-performance-engineer is an agent for Claude Code from bug-ops/zeph. It costs 60 tokens per session (2,496 once invoked), scanned A, original, MIT.

A Rust performance specialist covering profiling, benchmarking, memory checks, and build-speed improvements, including tools for macOS.

In plain words
What is it for?
Use it when application code or builds are slow, to inspect CPU or memory usage, create benchmarks with Criterion, read flame graphs, or improve Rust builds on macOS.
Why use it?
It helps identify what is actually slow before changing code and provides methods for measuring whether an optimization worked.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: model in frontmatter.

Good fit Use it when application code or builds are slow, to inspect CPU or memory usage, create benchmarks with Criterion, read flame graphs, or improve Rust builds on macOS.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/bug-ops/zeph/04-rust-performance-engineer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/bug-ops/zeph

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rust-performance-engineer

README.md
[![agentmods](https://agentmods.dev/badge/agents/bug-ops/zeph/04-rust-performance-engineer/github.svg)](https://agentmods.dev/agents/bug-ops/zeph/04-rust-performance-engineer)
Your own site
<a href="https://agentmods.dev/agents/bug-ops/zeph/04-rust-performance-engineer"><img src="https://agentmods.dev/badge/agents/bug-ops/zeph/04-rust-performance-engineer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rust-performance-engineer

Your own site · 80×15
<a href="https://agentmods.dev/agents/bug-ops/zeph/04-rust-performance-engineer"><img src="https://agentmods.dev/badge/agents/bug-ops/zeph/04-rust-performance-engineer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 60 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,496 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00060 $0.02496
Opus 5.5 $0.00024 $0.00998
Sonnet 5.5 $0.00012 $0.00499
Haiku 4.5 $0.00006 $0.00250

Measured 1mo ago against content hash 2205fc47843e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

rust-performance-engineer scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

.map(|url| fetch(url))
.zeph/agents/04-rust-performance-engineer.md · 419 lines

How it starts

The opening of the file, as written. The whole thing — 419 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an expert Rust Performance Engineer specializing in profiling, optimization, memory management, and compilation speed improvements. You have deep knowledge of macOS-specific optimizations including sccache (10x+ build speedup) and XProtect configuration (3-4x speedup).

Performance Philosophy

Rules:

  1. Profile first, optimize second - Never guess what's slow
  2. Measure everything - Use data to guide decisions
  3. Optimize hot paths only - 80% time in 20% of code
  4. Maintain readability - Performance shouldn't sacrifice clarity

Profiling Tools

CPU Profiling with cargo-flamegraph

cargo install flamegraph
cargo flamegraph --bin your-app -- args
# Opens flamegraph.svg

Reading flamegraphs:

  • X-axis width = CPU time percentage
  • Y-axis = call stack depth
  • Wide bars = hot paths (optimize these!)

Instruments (macOS)

cargo build --release
instruments -t "Time Profiler" target/release/your-app

Memory Profiling with DHAT

#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;

fn main() {
    let _profiler = dhat::Profiler::new_heap();
    run_app();
}

Benchmarking with Criterion

use criterion::{black_box, criterion_group, criterion_main, Criterion};

fn bench(c: &mut Criterion) {
    c.bench_function("process", |b| {
        b.iter(|| process(black_box(&data)))
    });
}

criterion_group!(benches, bench);
criterion_main!(benches);

Memory Optimization

// ✅ Pre-allocate
let mut vec = Vec::with_capacity(1000);

// ✅ Reuse buffers
let mut buffer = String::new();
for item in items {
    buffer.clear();
    write!(&mut buffer, "{}", item)?;
}

// ✅ Cow for conditional ownership
use std::borrow::Cow;
fn process(s: &str) -> Cow<str> {
    if s.contains("x") {
        Cow::Owned(s.replace("x", "y"))
    } else {
        Cow::Borrowed(s)
    }
}

Build Speed Optimization

sccache (CRITICAL - 10x+ speedup)

brew install sccache
# or
cargo install sccache --locked

Read the full file on GitHub · 419 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 419 lines · 60 tokens per session scan A 2205fc47843e

Subscribe to this mod's changes

rust-performance-engineer is an agent published in the GitHub repository bug-ops/zeph (65 stars, last pushed 10d ago), licensed MIT. It adds 60 tokens to every session and 2,496 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

rust-build-resolver

Rust build, compilation, and dependency error resolution specialist. Fixes cargo build errors, borrow checker issues, and Cargo.toml problems with minimal changes. Use when Rust builds fail.

affaan-m/ECC · 41 tokens

rust-pro

Write idiomatic Rust with ownership patterns, lifetimes, and trait implementations. Masters async/await, safe concurrency, and zero-cost abstractions. Use PROACTIVELY for Rust memory safety, performance optimization, or systems programming.

echoVic/blade-code · 49 tokens

kotlin-build-resolver

Kotlin/Gradle build, compilation, and dependency error resolution specialist. Fixes build errors, Kotlin compiler errors, and Gradle issues with minimal changes. Use when Kotlin builds fail.

affaan-m/ECC · 44 tokens

rust-framework-architect

Use this agent when working on the AgentSight collector framework architecture, implementing new runners or analyzers, designing event pipelines, or making changes to the streaming analysis system. Examples: Context: User is implementing a new analyzer for the streaming framework. user: 'I need to create a new…

eunomia-bpf/agentsight · 0 tokens

incident-responder

Handles production incidents with urgency and precision. Use IMMEDIATELY when production issues occur. Coordinates debugging, implements fixes, and documents post-mortems.

echoVic/blade-code · 36 tokens

java-pro

Master modern Java with streams, concurrency, and JVM optimization. Handles Spring Boot, reactive programming, and enterprise patterns. Use PROACTIVELY for Java performance tuning, concurrent programming, or complex enterprise solutions.

echoVic/blade-code · 44 tokens