performance

A performance-focused development rule set for measuring software speed, finding bottlenecks, choosing optimizations, and checking the results.

In plain words
What is it for?
Use it when establishing a baseline, profiling code, optimizing algorithms or components, and measuring whether a change helped.
Why use it?
It discourages guessing where code is slow and requires changes to be compared with measurements.

Cursor rule

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 rules/jakerains/citrusrules/performance
Clone the repo
git clone --depth 1 https://github.com/jakerains/CitrusRules
Per session 3,449 This file is loaded in full into every session.
When invoked 3,449 The same file — it is already loaded in full.
Security scan A 1 finding. 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.03449 $0.03449
Opus 5 $0.01724 $0.01724
Sonnet 5 $0.00690 $0.00690
Haiku 4.5 $0.00345 $0.00345

Measured yesterday against content hash 6a9e2d711f11, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

performance 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 yesterday.

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.

const response = await fetch(url, {
templates/performance.mdc · 516 lines

How it starts

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

Performance Optimization Standards

Implement performance-first development practices with systematic optimization strategies, efficient algorithms, and comprehensive monitoring. This rule ensures all code follows performance best practices from the ground up.

Performance Analysis Methodology

Before implementing any feature, I will:

  1. Baseline Measurement: Establish current performance metrics before changes
  2. Bottleneck Identification: Use profiling tools to identify actual performance constraints
  3. Impact Assessment: Evaluate the performance impact of proposed changes
  4. Optimization Strategy: Choose appropriate optimization techniques based on analysis
  5. Validation: Measure improvements after implementation

Core Performance Implementation Patterns

1. React Component Optimization Template

Use this pattern for all React components:

import { memo, useMemo, useCallback, useState, useEffect } from 'react';

interface OptimizedComponentProps {
  items: Array<{ id: string; name: string; score: number }>;
  filters: FilterOptions;
  onItemSelect: (id: string) => void;
  onBulkAction: (ids: string[]) => void;
}

export const OptimizedComponent = memo<OptimizedComponentProps>(({ 
  items, 
  filters, 
  onItemSelect, 
  onBulkAction 
}) => {
  // Memoize expensive computations
  const processedItems = useMemo(() => {
    return items
      .filter(item => matchesFilters(item, filters))
      .sort((a, b) => b.score - a.score)
      .slice(0, 100); // Limit initial render
  }, [items, filters]);

  // Memoize event handlers to prevent child re-renders
  const handleItemSelect = useCallback(
    (id: string) => () => onItemSelect(id),
    [onItemSelect]
  );

  const handleBulkSelect = useCallback(
    (selectedIds: string[]) => {
      onBulkAction(selectedIds);
    },
    [onBulkAction]
  );

  // Virtualization for large lists
  const [visibleRange, setVisibleRange] = useState({ start: 0, end: 50 });

  return (
    <VirtualizedContainer
      itemCount={processedItems.length}
      onRangeChange={setVisibleRange}
    >
      {processedItems.slice(visibleRange.start, visibleRange.end).map(item => (
        <MemoizedListItem
          key={item.id}
          item={item}
          onSelect={handleItemSelect(item.id)}
        />
      ))}
    </VirtualizedContainer>
  );
}, (prevProps, nextProps) => {
  // Custom comparison for complex props
  return (
    prevProps.items.length === nextProps.items.length &&
    shallowEqual(prevProps.filters, nextProps.filters)
  );
});

// Memoized child component
const MemoizedListItem = memo<{
  item: ListItem;
  onSelect: () => void;
}>(({ item, onSelect }) => (
  <div onClick={onSelect} className="list-item">
    <span>{item.name}</span>
    <span className="score">{item.score}</span>
  </div>
));

Read the full file on GitHub · 516 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. yesterday First seen · 516 lines · 3,449 tokens per session scan A 6a9e2d711f11

Subscribe to this mod's changes

performance is a cursor rule published in the GitHub repository jakerains/CitrusRules (2 stars, last pushed 1y ago), licensed MIT. It adds 3,449 tokens to every session, about $0.0172 per session on Opus 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-31.