Skip to content

Commit eec74a3

Browse files
authored
Ambiguity resolution policy (#3336)
performance first for APIs <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added performance validation guidelines for API execution code paths, including A/B benchmarking methodology with implementation examples. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 7389268 commit eec74a3

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,24 @@ ts.factory.createParameterDeclaration();
236236
ts.factory.createVariableStatement();
237237
```
238238

239+
### 14. Performance Priority
240+
241+
For code involved in API execution (routing, middlewares, schema definition, validation), performance is the highest
242+
priority. This does not apply to generators (`Integration`, `Documentation`).
243+
244+
When editing that code or choosing between multiple implementations in performance-critical scope, always A/B test it:
245+
246+
1. Create a benchmark in `express-zod-api/bench` (similar to `experiment.bench.ts`)
247+
2. Compare current vs featured solution (for refactoring) or two variants (for new code)
248+
3. Run benchmark via `pnpm bench`
249+
250+
```typescript
251+
describe("Experiment for feature", () => {
252+
bench("current", () => {}); // implementation A
253+
bench("featured", () => {}); // implementation B
254+
});
255+
```
256+
239257
## Breaking Change Policy
240258

241259
Any breaking change to the public API requires an update to the migration script, its tests, and CHANGELOG.

0 commit comments

Comments
 (0)