hermes

Profile and speed up a hot path

Measures a slow operation, profiles where the time goes, and makes it faster one verified change at a time, with before-and-after numbers. Use when an endpoint, command or function is too slow.

context

Performance work without measurement is guessing, and guesses are usually wrong about where the time goes. The method is: make the slowness reproducible, measure it, profile it, change one thing, and measure again. A speedup that was not measured did not happen.

task

Speed up: Goal: . Only if [ENVIRONMENT] is given: Environment and limits:

  1. Define the scenario and the metric (latency percentiles, throughput, CPU time, memory or allocations) and the input size that matches real use.
  2. Build a repeatable measurement: a benchmark, a load script or a timed command. Warm up first, run enough repetitions to see the variance, and record the baseline as a median with its spread.
  3. Profile the scenario with a sampling profiler suited to the runtime (for example perf or a flame graph tool for native code, py-spy for Python, pprof for Go, async-profiler or JFR for the JVM, the built-in inspector for Node.js, dotnet-trace for .NET). Use what is installed, or ask before installing anything.
  4. Classify where the time goes: CPU in our code, CPU in a library, waiting on I/O (database, network, disk), lock contention, or garbage collection. Name the top contributors with their share of the total.
  5. Form one hypothesis, make one change, and re-run the measurement. Keep the change only if the gain is larger than the noise. Run the tests after each kept change.
  6. Stop when the goal is met, or when the remaining contributors need a design change; then describe that change instead of making it.
constraints
  • No optimisation without profile evidence pointing at it.
  • One change per measurement, so every gain is attributable.
  • Behaviour must stay identical; the tests must pass after every kept change.
  • Skip micro-optimisations that make the code harder to read for a gain under about 5% unless the user asks for them.
  • Report real measured numbers with the number of runs. Never estimate a speedup you did not measure.
  • Before saying the work is done, run the check that proves it (tests, build, type check or the command the user gave) and report the real result.
  • If you could not run a check, say so plainly and say which one.
  • Do only what was asked. If you notice something else worth changing, mention it in one line at the end instead of changing it.
  • Keep the change as small as it can be while still being correct.
output format

Result

One line: metric before, after, number of runs, and whether the goal is met.

Where the time went

Table: contributor, share of total before, share after.

Changes

Numbered: the change — why the profile pointed there — measured effect.

Not done

Bigger opportunities that need a design change or a decision, with the expected benefit stated as a hypothesis.

How to reproduce

The exact commands to re-run the measurement.

1 required value still a placeholder; the assistant will ask for it.

details

kind
Prompt: a task you run by name to get one finished thing back
domain
Software engineering
category
Performance
level
Intermediate
made for
Software engineer, Backend engineer, Site reliability engineer
needs
repo-read, file-write, shell
risk
runs-commands
version
v1.0.0 · experimental
reviewed
2026-10-02
works in
Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Antigravity, OpenCode, Windsurf, Zed, Continue, AGENTS.md

Edit on GitHubReport a problem

use in

Hodios CLI
npx @hermes-hq/hodios install profile-hot-path --target claude-code
Agent Skills
npx skills add hermes-hq/hodios-dist --skill profile-hot-path -a claude-code
Add the Hodios marketplace (once)
claude plugin marketplace add hermes-hq/hodios-dist
Install the software-engineering plugin
claude plugin install hodios-software-engineering@hodios

The plugin brings every entry in this domain at once.

more in performance

All of Performance
PromptPerformance

Fix N+1 queries

Finds N+1 database queries behind an endpoint, page or job by counting real queries, fixes them with eager loading or batching, and adds a query-count test so they do not return.

fix-n-plus-one-queries
PromptPerformance

Reduce JavaScript bundle size

Measures a web app's JavaScript bundles, finds the largest avoidable contributors, and shrinks them with verified changes ranked by bytes saved. Use when page load is slow or a size budget is blown.

reduce-bundle-size
PromptPerformance

Find a memory leak

Finds a memory leak from heap snapshots, memory metrics and code, naming the retaining path and the minimal fix with a regression check. Use when memory grows until a process is killed or restarted.

find-memory-leak
PromptPerformance

Improve Core Web Vitals

Diagnoses poor Core Web Vitals (LCP, INP, CLS) from a Lighthouse, field-data or trace report and ranks fixes by expected improvement. Use when a page fails the vitals thresholds.

improve-web-vitals
PromptPerformance

Optimise a slow SQL query

Speeds up a slow SQL query from its execution plan, proposing rewrites and indexes with expected gains and their write-cost trade-offs. Use when one query dominates latency or database load.

optimize-sql-query
PersonaPerformance

Performance engineer

Acts as a performance engineer who profiles before optimising, changes one thing at a time and reports gains with numbers and variance. Use for latency, throughput or memory work.

performance-engineer