docs/plans/benchmark-improvements/005-establish-performance-baselines.md
Run the complete benchmark suite to establish initial performance baselines. Document expected performance ranges for all benchmark categories and configure alerting thresholds in CI.
Run benchmarks locally on a consistent machine to establish rough baselines:
# Ensure clean build
pnpm clean
pnpm install
pnpm build
# Run full benchmark suite 3 times
for i in 1 2 3; do
echo "=== Run $i ===" >> baseline-results.txt
pnpm bench >> baseline-results.txt 2>&1
done
Create a baseline document with expected performance ranges:
| Category | Benchmark | Expected ops/sec | Acceptable Range |
|---|---|---|---|
| Query Performance | |||
| Read | findUnique by id | TBD | ±20% |
| Read | findMany 10 records | TBD | ±20% |
| Read | findMany with includes | TBD | ±20% |
| Write | create single record | TBD | ±20% |
| Write | updateMany | TBD | ±20% |
| Aggregation | count | TBD | ±15% |
| Complex | blog post page query | TBD | ±25% |
| Compilation | |||
| Simple | compile findUnique simple | TBD | ±15% |
| Complex | compile findMany nested includes | TBD | ±20% |
| Realistic | compile blog post page | TBD | ±20% |
| Setup | instantiate query compiler | TBD | ±25% |
| Interpreter | |||
| Execution | interpreter: simple select | TBD | ±10% |
| Execution | interpreter: join (1:N) | TBD | ±15% |
| Mapping | dataMapper: 100 rows | TBD | ±10% |
| Serialization | serializer: 100 rows | TBD | ±10% |
| Client Generation | |||
| Generation | ~50 Models | TBD | ±30% |
| Generation | 100 models with relations | TBD | ±30% |
Trigger CI benchmark workflow to establish CodSpeed baseline:
rhysd/github-action-benchmark stores resultsReview and potentially adjust CI alert thresholds:
# Current setting in .github/workflows/benchmark.yml
alert-threshold: '200%' # Alert if 2x slower
Consider adjusting based on observed variance:
Update docs/benchmarking.md with baseline information:
Document the environment used for baselines:
For each benchmark, capture:
docs/benchmarking.md updated with baselines