A performance pass workflow for AI pair programmers

Performance work with agents fails when optimization starts before measurement. A performance pass is a loop: baseline, hypothesis, change, re-measure, keep or.

Published 2026-11-09 · Translation: VI

Performance work with agents fails when optimization starts before measurement. A performance pass is a loop: baseline, hypothesis, change, re-measure, keep or revert. No anecdotes.

The trap is micro-optimizations and premature caching. Without budgets and profiles, agents complicate code for gains you cannot see, or for “wins” that miss the real bottleneck.

Ready for a performance pass?

Define the user-visible metric and environment up front. Lab-only wins that vanish in production are not wins. Check the harness into the repo next to the code it measures so agents and reviewers run the same command.

Measure → change one thing → re-measure

Measure Loop

Measure Loop

Practical loop:

  1. Name the metric and scenario: p95 latency, allocation rate, bundle size, query count, plus hardware/env notes.
  2. Capture a baseline with the harness you will reuse after changes.
  3. Ask for hypotheses ranked by likely impact, tied to profile evidence, not generic tips.
  4. Implement one hypothesis. Forbid drive-by cleanups in the same diff.
  5. Re-measure with identical methodology. Keep only changes that move the metric beyond noise.
  6. Document in the PR: before/after, variance, and tradeoffs (memory vs CPU, readability).

Reject PRs that claim improvement without numbers in the template. Watch complexity taxes: a 2% gain that adds a fragile cache may be a net loss.

Three traps agents love

Failure modes to catch early

Failure modes to catch early

  • No baseline. Optimize on vibes. Fix: refuse the pass until a number exists.
  • Bundle five fixes. Attribution dies; revert is hard. Fix: one hypothesis per PR.
  • Wrong bench. Microbench wins; users feel nothing. Fix: measure the user-visible path, including I/O wait.

When to run the pass

When this fits vs when it does not

When this fits vs when it does not

On hot paths before releases, after architecture changes, and when SLOs threaten. Not as endless tinkering between feature work.

Bottom line

Measure first, change second, re-measure always. Agents accelerate a disciplined loop. They do not replace numbers.

Related: Measure coding-agent ROI without vanity metrics and Add observability with agents without noise spam.

Share

X Facebook LinkedIn
Educational content only. Rankings reflect stated criteria at the update date—not investment advice or permanent performance guarantees.