perf(router-core): derive match frame depth - #7973
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 |
|
View your CI Pipeline Execution ↗ for commit d808c70
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview5 package(s) bumped directly, 18 bumped as dependents. 🟩 Patch bumps
|
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. |
Merging this PR will regress 4 benchmarks
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | mem server error-paths not-found (vue) |
324.7 KB | 2,124.7 KB | -84.72% |
| ❌ | Memory | mem server error-paths not-found (solid) |
415.1 KB | 799.3 KB | -48.07% |
| ❌ | Memory | mem server serialization-payload (react) |
3.2 MB | 3.5 MB | -8.46% |
| ❌ | Simulation | ssr dehydrate rich types (vue) |
135.2 ms | 140 ms | -3.48% |
| ⚡ | Memory | mem server server-fn-churn (vue) |
4,147.3 KB | 275.8 KB | ×15 |
| ⚡ | Memory | mem server error-paths unmatched (vue) |
2,142.1 KB | 478.9 KB | ×4.5 |
| ⚡ | Memory | mem server peak-large-page (react) |
1,737.5 KB | 943.4 KB | +84.17% |
| ⚡ | Memory | mem server error-paths redirect (solid) |
388 KB | 289 KB | +34.25% |
| ⚡ | Memory | mem server error-paths redirect (vue) |
338.6 KB | 306.2 KB | +10.61% |
| ⚡ | Memory | mem client navigation-churn (vue) |
1.3 MB | 1.2 MB | +3.83% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing codex/bundle-size-principles (d808c70) with main (697ebb6)
Summary
depthfield from private route-match stack framesWhy
Every match frame already carries a trie node whose immutable
depthis the source used by branch construction. Copying that same fact onto every speculative frame adds a non-mangleable object key, a property store, and a larger frame shape.This applies the “one fact, one representation” principle without changing a public API or restructuring the matcher.
Measurements
react-router.minimal:The full 17-scenario matrix improved gzip by 29–54 bytes in every scenario, initial gzip in every scenario, and raw output by 90–110 bytes. Brotli varied from -115 to +127 bytes across differently chunked apps; gzip is the benchmark’s primary metric and raw output decreased everywhere.
Focused
findSingleMatchmeans also improved directionally:All benchmark RMEs were below 1%; the mixed-optional result is the clearest signal.
Checks
@tanstack/router-core:test:unit: 105 files passed; 1,524 passed, 3 expected failures@tanstack/router-core:test:types: TypeScript 5.6, 5.7, 5.8, 5.9, 6.0, and 7.0 passed@tanstack/router-core:test:eslint: 0 errors (26 existing warnings)