perf(router-core): evaluate head/scripts across matches in parallel - #8145
perf(router-core): evaluate head/scripts across matches in parallel#8145Sheraff wants to merge 2 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bundle Size Benchmarks
The following scenarios have bundle-size changes compared with the baseline:
Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better. |
🚀 Changeset Version Preview4 package(s) bumped directly, 19 bumped as dependents. 🟩 Patch bumps
|
|
View your CI Pipeline Execution ↗ for commit 61d058f
☁️ Nx Cloud last updated this comment at |
Merging this PR will regress 8 benchmarks
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | mem client unique-location-churn (solid) |
265.7 KB | 643.2 KB | -58.69% |
| ❌ | Memory | mem server error-paths redirect (solid) |
382.2 KB | 659.7 KB | -42.06% |
| ❌ | Memory | mem client navigation-churn (solid) |
592.5 KB | 707.5 KB | -16.24% |
| ❌ | Memory | mem client unique-location-churn (vue) |
467.7 KB | 523.6 KB | -10.68% |
| ❌ | Memory | mem server peak-large-page (vue) |
1 MB | 1.1 MB | -10.68% |
| ❌ | Memory | mem client interrupted-navigations (vue) |
368.7 KB | 394.4 KB | -6.52% |
| ❌ | Memory | mem server error-paths unmatched (solid) |
559.8 KB | 588.1 KB | -4.81% |
| ❌ | Memory | mem server server-fn-churn (react) |
378.9 KB | 393.5 KB | -3.72% |
| ⚡ | Memory | mem server error-paths not-found (vue) |
2,304.3 KB | 481.3 KB | ×4.8 |
| ⚡ | Memory | mem server error-paths unmatched (react) |
544.1 KB | 487.4 KB | +11.63% |
| ⚡ | Memory | mem server aborted-requests (vue) |
1,110.1 KB | 1,013.7 KB | +9.52% |
| ⚡ | Memory | mem server error-paths not-found (react) |
423.7 KB | 401.2 KB | +5.62% |
| ⚡ | Memory | mem server serialization-payload (vue) |
4.5 MB | 4.3 MB | +4.79% |
| ⚡ | Memory | mem server peak-large-page (react) |
1.2 MB | 1.2 MB | +4.5% |
| ⚡ | Memory | mem client navigation-churn (vue) |
1.6 MB | 1.6 MB | +4.11% |
| ⚡ | Memory | mem server request-churn (vue) |
848.2 KB | 816.6 KB | +3.87% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing perf/task4-parallel-head-scripts (61d058f) with main (d83a896)
Summary
projectLane(load-server.ts + load-client.ts) awaited each match's head/scripts(/headers) sequentially — total latency was the sum of all resolutions instead of the max.Behavioral equivalence (strict)
Each preserved ordering has a dedicated test in
tests/head-scripts-parallel.test.ts(10 tests):ssr:false/ error /_notFound) unchangedCaught during verification: a first implementation wrapped results in an extra
.thenlayer; that single extra microtask tick flipped a real scheduling race sorunBackground's publish landed afterrouter.load()resolved — caught by the existingpublic-hydration-contract.test.ts. Fixed by awaiting the raw attempt promise (identical await-chain depth to original).Performance
N=6 heads × 60ms: sequential 362ms → projectLane 62ms (~max, not sum).
Verification
test:unit ✅ (107 files / 1616 tests) · eslint ✅ · types ✅
Residual risks (documented in RESULT-perf-task4.md)