Skip to content

perf(router): reduce SSR lane loading overhead - #7875

Merged
Sheraff merged 2 commits into
fix-router-core-lane-match-loaderfrom
fix-router-ssr-loader-performance
Jul 22, 2026
Merged

perf(router): reduce SSR lane loading overhead#7875
Sheraff merged 2 commits into
fix-router-core-lane-match-loaderfrom
fix-router-ssr-loader-performance

Conversation

@Sheraff

@Sheraff Sheraff commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • avoid creating async route-chunk tasks for matches that do not need server rendering
  • reuse settled lazy component imports during React and Solid SSR while preserving browser and retry behavior
  • avoid unnecessary Solid route-option subscriptions during server rendering

Performance

  • React loader SSR benchmark: approximately 7.38 ms
  • Solid loader SSR benchmark: approximately 8.20-8.23 ms
  • all 17 client bundle scenarios remain byte-for-byte unchanged for gzip, initial, raw, and Brotli metrics

Validation

  • React lazy component unit tests
  • Solid Router full client and server unit suites
  • router-core focused SSR, chunk, and cancellation tests
  • React and Solid type tests with TypeScript 5.5 through 6.0
  • router-core, React Router, and Solid Router ESLint targets
  • package, SSR fixture, and bundle-size builds

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dac552b8-7666-465a-a67e-e746a4728aa0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-router-ssr-loader-performance

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit afcb006

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 13m 16s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2m 18s View ↗

☁️ Nx Cloud last updated this comment at 2026-07-22 06:54:47 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: 2a07a6657dcb
  • Measured at: 2026-07-22T06:42:30.769Z
  • Baseline source: history:edf55759d8e9
  • Dashboard: bundle-size history

The following scenarios have bundle-size changes compared with the baseline:

Scenario Current (gzip) Delta vs baseline Initial gzip Raw Brotli Trend
react-router.minimal 87.31 KiB -41 B (-0.05%) 87.17 KiB 269.66 KiB 76.00 KiB ███████████▁
react-router.full 90.97 KiB -91 B (-0.10%) 90.84 KiB 281.45 KiB 79.22 KiB ███████████▁
solid-router.minimal 35.05 KiB -489 B (-1.34%) 34.92 KiB 100.44 KiB 31.61 KiB ███████████▁
solid-router.full 40.00 KiB -596 B (-1.43%) 39.88 KiB 115.45 KiB 36.03 KiB ███████████▁
vue-router.minimal 52.22 KiB -795 B (-1.46%) 52.10 KiB 143.53 KiB 47.03 KiB ███████████▁
vue-router.full 58.16 KiB -799 B (-1.32%) 58.03 KiB 162.08 KiB 52.20 KiB ███████████▁
react-start.minimal 102.23 KiB +250 B (+0.24%) 102.09 KiB 318.16 KiB 88.54 KiB ▁▁▁▁▁▁▁▁▁▁▁█
react-start.deferred-hydration 102.96 KiB +247 B (+0.23%) 102.12 KiB 319.54 KiB 89.33 KiB ▁▁▁▁▁▁▁▁▁▁▁█
react-start.full 105.57 KiB +216 B (+0.20%) 105.44 KiB 328.16 KiB 91.45 KiB ▁▁▁▁▁▁▁▁▁▁▁█
react-start.rsbuild.minimal 99.85 KiB +178 B (+0.17%) 99.68 KiB 312.65 KiB 86.06 KiB ▁▁▁▁▁▁▁▁▁▁▁█
react-start.rsbuild.minimal-iife 100.25 KiB +180 B (+0.18%) 100.09 KiB 313.59 KiB 86.50 KiB ▁▁▁▁▁▁▁▁▁▁▁█
react-start.rsbuild.full 103.19 KiB +301 B (+0.29%) 103.02 KiB 322.80 KiB 88.87 KiB ▁▁▁▁▁▁▁▁▁▁▁█
solid-start.minimal 49.81 KiB +210 B (+0.41%) 49.68 KiB 147.83 KiB 44.16 KiB ▁▁▁▁▁▁▁▁▁▁▁█
solid-start.deferred-hydration 53.08 KiB +213 B (+0.39%) 49.74 KiB 155.87 KiB 47.10 KiB ▁▁▁▁▁▁▁▁▁▁▁█
solid-start.full 55.09 KiB -335 B (-0.59%) 54.96 KiB 163.62 KiB 48.65 KiB ███████████▁
vue-start.minimal 70.54 KiB -506 B (-0.70%) 70.41 KiB 200.81 KiB 62.53 KiB ███████████▁
vue-start.full 74.50 KiB -550 B (-0.72%) 74.37 KiB 213.41 KiB 66.08 KiB ███████████▁

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.

@pkg-pr-new

pkg-pr-new Bot commented Jul 22, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@7875

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@7875

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@7875

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@7875

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@7875

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@7875

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@7875

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@7875

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@7875

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@7875

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@7875

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@7875

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@7875

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@7875

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@7875

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@7875

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@7875

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@7875

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@7875

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@7875

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@7875

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@7875

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@7875

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@7875

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@7875

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@7875

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@7875

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@7875

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@7875

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@7875

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@7875

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@7875

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@7875

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@7875

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@7875

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@7875

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@7875

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@7875

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@7875

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@7875

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@7875

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@7875

commit: 389e717

@codspeed-hq

codspeed-hq Bot commented Jul 22, 2026

Copy link
Copy Markdown

Merging this PR will regress 5 benchmarks

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 13 improved benchmarks
❌ 5 regressed benchmarks
✅ 162 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory mem server error-paths not-found (solid) 707 KB 930.5 KB -24.02%
Memory mem server serialization-payload (vue) 3.4 MB 3.7 MB -8.35%
Memory mem client navigation-churn (solid) 525.2 KB 549.3 KB -4.39%
Simulation ssr request loop (solid) 158 ms 164 ms -3.65%
Memory mem server server-fn-churn (react) 274.2 KB 283.4 KB -3.26%
Memory mem server peak-large-page (react) 2,033.2 KB 944.5 KB ×2.2
Memory mem server error-paths redirect (vue) 460 KB 293.3 KB +56.82%
Memory mem server aborted-requests (react) 746.5 KB 560.4 KB +33.22%
Memory mem client unique-location-churn (solid) 401.4 KB 342.4 KB +17.24%
Memory mem server error-paths not-found (react) 276.9 KB 254.9 KB +8.63%
Simulation ssr dehydrate plain control (react) 53.9 ms 49.9 ms +8.15%
Simulation ssr dehydrate plain control (solid) 72.9 ms 68.6 ms +6.26%
Simulation ssr before-load chain (react) 53.3 ms 50.3 ms +6.14%
Simulation ssr server-fn during document ssr (react) 67.7 ms 64 ms +5.72%
Memory mem server server-fn-churn (vue) 274.5 KB 263.7 KB +4.1%
Simulation ssr global-mw server-fn (solid) 59.8 ms 57.6 ms +3.75%
Simulation ssr assets inline-css cdn (solid) 62 ms 60.1 ms +3.2%
Simulation ssr assets inline-css cdn (react) 52.9 ms 51.3 ms +3.19%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing fix-router-ssr-loader-performance (389e717) with fix-router-core-lane-match-loader (1f27102)

Open in CodSpeed

@Sheraff
Sheraff merged commit 03a1fde into fix-router-core-lane-match-loader Jul 22, 2026
25 of 26 checks passed
@Sheraff
Sheraff deleted the fix-router-ssr-loader-performance branch July 22, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant