一键导入
performance
Use when changing loops, collection processing, invalidation logic, tree/diff traversal, path scanning, virtualized rendering calculations, or any code where repeated scans or boolean control flow affect performance or correctness.
菜单
Use when changing loops, collection processing, invalidation logic, tree/diff traversal, path scanning, virtualized rendering calculations, or any code where repeated scans or boolean control flow affect performance or correctness.
Use when preparing, splitting, reviewing, or creating git commits in this repo, especially after larger implementations that should be broken into independently verified commits.
Use when opening, inspecting, clicking, filling, snapshotting, or otherwise automating web pages for this repo, including local dev servers and browser-based verification.
Use when adding or running tests, checking snapshots, choosing between Bun tests and Playwright, running lint/format/typecheck, or deciding the verification scope for a change.
Use when running repo scripts, adding or changing dependencies, editing package.json files, installing packages, or deciding how Bun workspace commands should be invoked in this monorepo.
Use when adding or changing packages/apps, TypeScript configs, workspace dependencies, package references, exports, or monorepo project-reference relationships.
Use when working with the repo's bun run wt helper, Pierre-managed worktrees, dev-server port offsets, stale server cleanup, Playwright fixtures, or Chrome debug instances. Do not use this as a substitute for host-provided workspace isolation.
| name | performance |
| description | Use when changing loops, collection processing, invalidation logic, tree/diff traversal, path scanning, virtualized rendering calculations, or any code where repeated scans or boolean control flow affect performance or correctness. |
Avoid nested loops and O(n^2) operations unless there is a clear reason.
Example of the preferred pattern:
let lastMeaningfulIndex = items.length - 1;
for (let i = items.length - 1; i >= 0; i--) {
if (items[i].someCondition) {
lastMeaningfulIndex = i;
break;
}
}
for (let i = 0; i <= lastMeaningfulIndex; i++) {
const isLast = i === lastMeaningfulIndex;
// ...
}
After changing boolean logic or invalidation paths, simplify the final control
flow before calling the work done. If code is already inside if (foo), do not
keep || foo in assignments inside that block.