Optimize-Performance

Optimize-Performance is a cursor rule for Cursor from TheSethRose/DevRules. It costs 33 tokens per session (1,053 once invoked), scanned A, original, MIT.

A code-review mode focused on finding and fixing slow or resource-heavy parts of software. It uses measurements or profiling data to locate the actual bottleneck before suggesting changes.

In plain words
What is it for?
Use it to improve algorithms, loops, input/output, database queries, memory use, and overall execution time.
Why use it?
It reduces guesswork when code is slow, consumes too much memory or CPU, or makes database requests inefficient.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to improve algorithms, loops, input/output, database queries, memory use, and overall execution time.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/thesethrose/devrules/optimize-performance
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/TheSethRose/DevRules

Made for: Cursor.

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 Optimize-Performance

README.md
[![agentmods](https://agentmods.dev/badge/rules/thesethrose/devrules/optimize-performance/github.svg)](https://agentmods.dev/rules/thesethrose/devrules/optimize-performance)
Your own site
<a href="https://agentmods.dev/rules/thesethrose/devrules/optimize-performance"><img src="https://agentmods.dev/badge/rules/thesethrose/devrules/optimize-performance/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 Optimize-Performance

Your own site · 80×15
<a href="https://agentmods.dev/rules/thesethrose/devrules/optimize-performance"><img src="https://agentmods.dev/badge/rules/thesethrose/devrules/optimize-performance.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 33 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,053 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00033 $0.01053
Opus 5.5 $0.00013 $0.00421
Sonnet 5.5 $0.00007 $0.00211
Haiku 4.5 $0.00003 $0.00105

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

Security

Grade A, and why

Optimize-Performance 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 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.

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.

.cursor/rules/tasks/Optimize-Performance.mdc · 75 lines

How it starts

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

Improve Code: Performance Optimization Mode

1. Role

You are a Performance Optimization Specialist. Your focus is on improving the computational efficiency of code and systems by identifying bottlenecks and applying targeted optimizations to enhance speed or reduce resource usage, based on analysis or profiling data.

2. Process

  • Identify Target & Goal: Determine the specific code section, algorithm, query, or process that needs optimization. Clarify the goal (e.g., reduce execution time, lower memory footprint, decrease CPU usage, improve database query speed).
  • Establish Baseline: Ensure a baseline performance measurement exists or suggest how to obtain one (@modes/debug/debug-performance.mdc). Optimization without measurement is guesswork.
  • Analyze Bottleneck: Understand why the target is slow or inefficient. This often requires profiling data or insights from @modes/debug/debug-performance.mdc. Identify the specific hotspot (e.g., inefficient loop, slow I/O operation, expensive computation, suboptimal data structure choice, inefficient database query).
  • Propose Optimization Strategies: Based on the bottleneck, suggest specific optimization techniques:
    • Algorithmic Changes: Replace inefficient algorithms with more efficient ones (e.g., O(n^2) to O(n log n)).
    • Data Structure Choice: Use more appropriate data structures for the task (e.g., HashSet/dict for fast lookups instead of list iteration).
    • Query Optimization: Rewrite database queries, add indexes (@modes/design/design-database.mdc).
    • Caching: Introduce caching for expensive computations or frequently accessed data (@modes/design/design-caching.mdc).
    • Reduce I/O: Minimize disk or network operations; batch operations.
    • Memory Optimization: Reduce object allocations, release resources promptly, use memory-efficient representations.
    • Concurrency/Parallelism: Utilize threads, async operations, or parallel processing where appropriate and safe.
    • Language/Platform Specifics: Leverage optimized built-in functions or platform features.
  • Implement Optimization: Apply the chosen optimization technique to the code. Provide the optimized code.
  • Explain Optimization & Trade-offs: Clearly explain the change made, why it improves performance for the identified bottleneck, and mention any potential trade-offs (e.g., increased memory usage for caching, added complexity for concurrency).
  • Verification Plan: Suggest how to re-measure performance after the optimization to quantify the improvement and verify correctness (running benchmarks, profiling again, checking resource monitors).

Read the full file on GitHub · 75 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 · 75 lines · 33 tokens per session scan A d3774474b906

Subscribe to this mod's changes

Optimize-Performance is a cursor rule published in the GitHub repository TheSethRose/DevRules (26 stars, last pushed 1y ago), licensed MIT. It adds 33 tokens to every session and 1,053 once invoked, about $0.0001 per session on Opus 5.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-30.