perf: compact private bundle boundaries - #7975
Conversation
📝 WalkthroughWalkthroughThe PR replaces selected internal object-shaped values and helper parameters with tuples or positional arguments. It updates browser history batching, route matching, Solid nearest-match context, server-function request bodies, Vue script rendering, and Vue link helpers. Browser history tests cover queue coalescing and flushing. ChangesBrowser history batching
Lightweight route matching
Solid nearest-match context
Server function request bodies
Vue router rendering helpers
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 ba8e35b
☁️ 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 (solid) |
415.1 KB | 848.3 KB | -51.07% |
| ❌ | Memory | mem client unique-location-churn (solid) |
341.2 KB | 564.6 KB | -39.57% |
| ❌ | Memory | mem server peak-large-page (solid) |
811.5 KB | 842.2 KB | -3.64% |
| ❌ | Simulation | ssr request loop (solid) |
156.5 ms | 161.4 ms | -3.01% |
| ⚡ | Memory | mem server server-fn-churn (vue) |
4,147.3 KB | 265.2 KB | ×16 |
| ⚡ | Memory | mem server error-paths unmatched (vue) |
2,142.1 KB | 479.6 KB | ×4.5 |
| ⚡ | Memory | mem server peak-large-page (react) |
1,737.5 KB | 952.1 KB | +82.48% |
| ⚡ | Memory | mem server error-paths redirect (solid) |
388 KB | 282.6 KB | +37.3% |
| ⚡ | Memory | mem server error-paths redirect (vue) |
338.6 KB | 295.8 KB | +14.48% |
| ⚡ | Memory | mem client navigation-churn (vue) |
1.3 MB | 1.2 MB | +4.6% |
| ⚡ | Simulation | client-head navigation loop (react) |
76.2 ms | 73.2 ms | +4.02% |
| ⚡ | Simulation | client-head navigation loop (vue) |
94.3 ms | 90.9 ms | +3.64% |
| ⚡ | Memory | mem server aborted-requests (solid) |
930.4 KB | 901 KB | +3.26% |
| ⚡ | Simulation | ssr control-flow unmatched 404 (react) |
58.1 ms | 56.4 ms | +3% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing codex/compact-private-boundaries (ba8e35b) with main (697ebb6)
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/vue-router/src/link.tsx (1)
628-641: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPreserve the search type in
getIsActive.Lines 631 and 636 use
search: any. This removes type checking from the active-state comparison. Replace both inline location shapes with a sharedParsedLocation-derived or generic type that preserves the router search schema.Proposed type-safe shape
+type LinkMatchLocation = Pick< + ParsedLocation, + 'pathname' | 'search' | 'hash' +> + function getIsActive( - loc: { pathname: string; search: any; hash: string }, - nextLoc: { pathname: string; search: any; hash: string }, + loc: LinkMatchLocation, + nextLoc: LinkMatchLocation,Please confirm that the selected type remains assignable to router locations for all search schemas.
As per coding guidelines, TypeScript files must use strict mode with extensive type safety.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/vue-router/src/link.tsx` around lines 628 - 641, Update getIsActive so both loc and nextLoc use a shared ParsedLocation-derived or generic location type instead of inline search: any shapes, preserving the router’s search schema and remaining assignable to router locations across all search schemas. Keep pathname and hash typing intact while restoring strict type checking for search comparisons.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/vue-router/src/link.tsx`:
- Around line 628-641: Update getIsActive so both loc and nextLoc use a shared
ParsedLocation-derived or generic location type instead of inline search: any
shapes, preserving the router’s search schema and remaining assignable to router
locations across all search schemas. Keep pathname and hash typing intact while
restoring strict type checking for search comparisons.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 6aa90a02-72d0-4ef1-b441-9f732d08f0dd
📒 Files selected for processing (10)
packages/history/src/index.tspackages/history/tests/createBrowserHistory.test.tspackages/router-core/src/router.tspackages/solid-router/src/Match.tsxpackages/solid-router/src/Matches.tsxpackages/solid-router/src/matchContext.tsxpackages/solid-router/src/useMatch.tsxpackages/start-client-core/src/client-rpc/serverFnFetcher.tspackages/vue-router/src/Scripts.tsxpackages/vue-router/src/link.tsx
Summary
All public options, callbacks, component props, browser history state, and serialized HTTP formats remain unchanged.
Bundle size
Measured against
mainat697ebb6ddbd433d052b6b4707938a5c595865d58:The isolated measurements and full matrix are in
RESULT-optimization-compact-private-boundaries.md.Performance
The retained lightweight-match tuple was effectively flat in repeated
buildLocationbenchmarks: cached and uncached results stayed within 0.8% with benchmark error around 3%.An additional LRU tuple experiment saved 9 B gzip but slowed eviction-heavy churn by roughly 24%, so it was rejected and is not part of this PR.
Validation
Summary by CodeRabbit
Bug Fixes
Refactor