perf

perf is a command for coding agents from areu01or00/perf-hints. It costs 16 tokens per session (1,141 once invoked), scanned A, original, MIT.

A command for investigating and improving software performance. It estimates whether an optimization matters, measures bottlenecks, applies fixes, and checks the results.

In plain words
What is it for?
Use it to scope a performance problem, analyze API or other code areas, profile and benchmark behavior, and validate optimization changes.
Why use it?
It helps avoid guessing at the cause of slow code or spending time improving parts that are not limiting performance.

Command

Part of the perf plugin — 1 skill, 1 command, 2 agents shipped together

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.

agentmods
npx agentmods add commands/areu01or00/perf-hints/perf
Clone the repo
git clone --depth 1 https://github.com/areu01or00/perf-hints

Or install perf, the plugin that ships this one along with the rest of its 1 skill, 1 command, 2 agents.

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 perf

README.md
[![agentmods](https://agentmods.dev/badge/commands/areu01or00/perf-hints/perf.svg)](https://agentmods.dev/commands/areu01or00/perf-hints/perf)
Your own site
<a href="https://agentmods.dev/commands/areu01or00/perf-hints/perf"><img src="https://agentmods.dev/badge/commands/areu01or00/perf-hints/perf.svg" alt="Measured on agentmods" height="20"></a>
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,141 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00016 $0.01141
Opus 5 $0.00008 $0.00571
Sonnet 5 $0.00003 $0.00228
Haiku 4.5 $0.00002 $0.00114

Measured 4d ago against content hash fcbf9b3768f9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

perf scanned grade A with 0 findings 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 4d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/perf.md · 163 lines

How it starts

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

Performance Optimization

You are helping a developer optimize code for performance. Follow Jeff Dean and Sanjay Ghemawat's systematic approach: estimate first, measure, identify bottlenecks, then fix with validation.

Core Principles

  • Estimate before optimizing: Back-of-envelope calculations tell you if optimization matters
  • Quantify everything: "Faster" means nothing without numbers
  • Fix the right thing: Profile shows where time goes, not what to fix
  • Validate fixes: Optimizations that break correctness are worse than slow code
  • Use TodoWrite: Track all progress throughout

Phase 1: Scoping

Goal: Understand what needs optimization

Target: $ARGUMENTS

Actions:

  1. Create todo list with all phases
  2. If scope unclear, ask user:
    • What's slow? (specific endpoint, feature, operation)
    • How slow is it now?
    • What's the target?
    • Any constraints? (can't change API, memory limits, etc.)
  3. Confirm understanding before proceeding

Phase 2: Analysis

Goal: Back-of-envelope estimation and bottleneck detection

Actions:

  1. Launch 2-3 perf-analyzer agents in parallel, each focusing on:

    • Different parts of the codebase (e.g., API layer, data layer, external calls)
    • Or different optimization angles (I/O patterns, memory patterns, algorithmic complexity)

    Example agent prompts:

    • "Analyze the [endpoint/feature] for I/O bottlenecks - sequential calls, missing parallelization, client reuse"
    • "Do back-of-envelope calculation for [operation] - estimate latency breakdown"
    • "Find allocation patterns and memory inefficiencies in [module]"
  2. Once agents return, read all files they identified

  3. Present consolidated findings:

    • Back-of-envelope latency table
    • Bottlenecks ranked by impact
    • Estimated total improvement possible

Phase 3: Clarifying Questions

Goal: Resolve ambiguities before implementing

CRITICAL: Do not skip this phase.

Actions:

  1. Based on analysis, identify decisions that need user input:
    • Trade-offs (memory vs speed, complexity vs performance)
    • Scope (fix everything vs highest ROI only)
    • Constraints (can't change external APIs, must maintain compatibility)
  2. Present questions to user
  3. Wait for answers before proceeding

Read the full file on GitHub · 163 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. 4d ago First seen · 163 lines · 16 tokens per session scan A fcbf9b3768f9

Subscribe to this mod's changes

perf is a command published in the GitHub repository areu01or00/perf-hints (4 stars, last pushed 8mo ago), licensed MIT. It adds 16 tokens to every session and 1,141 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.