review-perf

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Review Performance (internal)

性能审查(内部)

Composed by
review-change
/
product-audit
within their conversation — on any agent, follow this file inline as the routed step. Findings only; never edits, never refactors.
由对话中的
review-change
/
product-audit
组件调用——针对任意Agent,需按照本文件内容执行该路由步骤。仅输出审查结果;绝不编辑、重构代码。

Scope

审查范围

The diff or path/glob the caller passes; default the current change vs the default branch. State the scope at the top of the returned table.
调用方传入的差异内容或路径/通配符;默认对比当前变更与默认分支。需在返回表格顶部明确说明审查范围。

Checklist (evaluate EVERY item — none is optional; n/a must be stated)

检查清单(需评估每一项——无可选项;不适用项必须明确标注)

  • ✓ No N+1 query/IO pattern on changed data-access paths (loop bodies issuing queries/requests — cite)
  • ✓ Algorithmic complexity of new code paths stated where input can grow (an unbounded O(n²) on user data is a major finding)
  • ✓ No blocking IO/sync work added on hot/request paths where the platform is async
  • ✓ Resources opened by the change are closed/released on ALL paths including errors (files, connections, subscriptions, timers)
  • ✓ No unbounded growth introduced (caches without eviction, arrays that only append, listeners never removed)
  • ✓ Web only: bundle/asset impact of the change stated (new dep size, image weight, lazy-loading where the project uses it) — n/a otherwise
  • ✓ Repeated computation hoisted where a loop recomputes an invariant (cite)
  • ✓ Pagination/limits on any new listing that reads user-scaled data
  • ✓ No premature optimization either: complexity added for speed without a cited measurement is a finding (the repo forbids overengineering)
  • Measured evidence when declared — the project's agent guide declares a
    Performance commands
    block with a
    bench
    command AND the diff touches paths its benchmarks cover: RUN the benchmark on the base branch and on the change, and cite both numbers in Evidence as
    <cmd> → base <x> / change <y> (<±z%>)
    . A regression beyond the noise band (the project's declared band, else ±5%) is a major finding; a delta inside the band is no finding. The declared command failing (non-zero exit) is itself a finding (the gate can't measure) — never silently skipped.
  • No declared perf commands → state exactly
    n/a — no declared perf commands
    for the item above (never skip it silently), and if the diff adds algorithmic code on input that can grow, add a minor finding recommending the project adopt the tooling via
    init-workspace
    's Performance tooling round.
  • ✓ 变更的数据访问路径中不存在N+1查询/IO模式(循环体内发起查询/请求——需标注位置)
  • ✓ 针对输入规模可增长的新代码路径,需明确说明其算法复杂度(针对用户数据的无界O(n²)属于重大问题)
  • ✓ 在异步平台的热路径/请求路径中,未新增阻塞式IO/同步操作
  • ✓ 变更所打开的资源(文件、连接、订阅、定时器)需在所有路径(包括错误路径)中被关闭/释放
  • ✓ 未引入无界增长逻辑(无淘汰机制的缓存、仅追加的数组、永不移除的监听器)
  • ✓ 仅Web场景:需说明变更对包/资源的影响(新增依赖体积、图片大小、项目已启用的懒加载情况)——其他场景标注不适用
  • ✓ 循环中重复计算的不变量已被提取(需标注位置)
  • ✓ 所有读取用户规模数据的新列表均实现了分页/限制机制
  • ✓ 无过早优化行为:未提供性能数据却为提升速度增加复杂度属于问题(仓库禁止过度工程化)
  • 声明时需提供实测证据——项目的Agent指南中包含
    Performance commands
    模块及
    bench
    命令,且差异内容涉及基准测试覆盖的路径:需在基准分支和变更分支上运行基准测试,并在证据中注明
    <cmd> → base <x> / change <y> (<±z%>)
    。超出噪声范围(项目声明的范围,默认±5%)的退化属于重大问题;在噪声范围内的差异不属于问题。若声明的命令执行失败(非零退出码)本身就是问题(无法进行性能测量)——绝不能静默跳过。
  • 无声明的性能命令→ 需明确标注
    n/a — no declared perf commands
    (绝不能静默跳过),若差异内容新增了输入规模可增长的算法代码,需添加次要问题,建议通过
    init-workspace
    的性能工具环节为项目引入相关工具。

Return exactly

返回格式严格遵循以下模板

REVIEW PERF — scope: <scope>

| # | Finding | Sev | Evidence | Suggested fix |
|---|---------|-----|----------|---------------|
| 1 | <what>  | critical|major|minor | <file:line — or, for measured findings, `<cmd> → base <x> / change <y> (<±z%>)`> | <smallest action> |

Checklist: <n> evaluated, <n> pass, <n> findings, <n> n/a (<which + why>)
Summary: <1-2 sentences>
Decision: PASS | FAIL
FAIL if any critical or major finding is open; PASS otherwise. Minor findings never block — they route to the caller's triage step.
REVIEW PERF — scope: <scope>

| # | Finding | Sev | Evidence | Suggested fix |
|---|---------|-----|----------|---------------|
| 1 | <what>  | critical|major|minor | <file:line — or, for measured findings, `<cmd> → base <x> / change <y> (<±z%>)`> | <smallest action> |

Checklist: <n> evaluated, <n> pass, <n> findings, <n> n/a (<which + why>)
Summary: <1-2 sentences>
Decision: PASS | FAIL
若存在任何严重或重大问题则返回FAIL;否则返回PASS。次要问题不会阻塞流程——将路由至调用方的分类处理步骤。

Done when

完成标准

  • Every checklist item was evaluated with evidence (file:line or command output) or explicitly marked n/a with the reason.
  • The fixed-format block above is returned — nothing more, nothing less — and no code was changed.
  • 检查清单中的每一项均已通过证据(文件:行号或命令输出)评估,或明确标注不适用并说明原因。
  • 返回内容严格符合上述固定格式——不多不少,且未修改任何代码。