0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/benchmarks/ssr
Brenley Dueck 62f3b2697f
Upgrade solidjs beta 20 (#7850)
* chore: upgrade Solid v2 packages to 2.0.0-beta.20

Bumps solid-js and @solidjs/web from 2.0.0-beta.19 to 2.0.0-beta.20 and
vite-plugin-solid from 3.0.0-next.11 to 3.0.0-next.13 across packages,
examples, e2e apps, and benchmarks.

vite-plugin-solid 3.0.0-next.13 defaults to the new native JSX backend
(@dom-expressions/compiler), which is an incomplete milestone build that
cannot compile components with element children yet ("Only text and
expression component children are implemented in the AST-native
milestone"). Every vite-plugin-solid call site now passes
compiler: 'babel' to keep the babel-preset-solid pipeline until the
native compiler matures.

Also fixes two pins that had gone stale: the quickstart-webpack example's
direct babel-preset-solid pin (stuck on beta.18) and
@rsbuild/plugin-solid's babel-preset-solid lockfile resolution (also
beta.18), so the compiler and runtime are in lockstep everywhere.

Verified with solid-router test:unit (client + server modes) and
e2e/solid-start/basic (pnpm build + test:e2e:local).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: use the native JSX compiler (vite-plugin-solid default)

Removes the compiler: 'babel' escape hatch from all vite-plugin-solid
call sites, returning to next.13's default native backend
(@dom-expressions/compiler).

The native compiler's only unimplemented construct that this repo used
was a fragment passed as a component's child (dom mode only). The single
instance — the redundant <>{props.children}</> wrapper in solid-router's
ClientOnly — is removed; props.children is a valid JSX child on its own.

Verified: solid-router test:unit (client + server), e2e/solid-start/basic
(pnpm build + test:e2e:local), and a direct scan of all 1353 solid
.tsx/.jsx files in the repo through @dom-expressions/compiler in both
dom and ssr modes with zero failures.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
History 2026-07-18 18:10:06 +02:00
..
react ssr benchmarks (#7606) 2026-06-12 22:04:10 +02:00
scenarios fix: update solid ssr benchmark types 2026-06-13 16:32:33 -05:00
solid Merge branch 'main' into solid-router-main-merge2 2026-06-13 15:54:31 -05:00
vue ssr benchmarks (#7606) 2026-06-12 22:04:10 +02:00
bench-utils.ts bench: calibrate new ssr benchmarks iteration to reduce variability (#7625) 2026-06-13 15:21:57 +02:00
package.json Upgrade solidjs beta 20 (#7850) 2026-07-18 18:10:06 +02:00
README.md ssr benchmarks (#7606) 2026-06-12 22:04:10 +02:00
tsconfig.json test: add cross-framework SSR request-loop benchmarks (#6803) 2026-03-03 10:45:15 +01:00
vitest.config.ts ssr benchmarks (#7606) 2026-06-12 22:04:10 +02:00
vitest.react.config.ts ssr benchmarks (#7606) 2026-06-12 22:04:10 +02:00
vitest.solid.config.ts ssr benchmarks (#7606) 2026-06-12 22:04:10 +02:00
vitest.vue.config.ts ssr benchmarks (#7606) 2026-06-12 22:04:10 +02:00

SSR Benchmarks

Cross-framework SSR request-loop benchmarks for:

  • @tanstack/react-start
  • @tanstack/solid-start
  • @tanstack/vue-start

Each benchmark builds a Start app with file-based routes and runs Vitest benches against the built server handler.

Layout

  • react/ - React Start baseline benchmark + Vitest config
  • solid/ - Solid Start baseline benchmark + Vitest config
  • vue/ - Vue Start baseline benchmark + Vitest config
  • vitest.react.config.ts, vitest.solid.config.ts, vitest.vue.config.ts - per-framework aggregate configs that run the baseline first, then scenario projects
  • scenarios/<scenario>/<framework>/ - isolated scenario apps

Scenario app layout:

scenarios/<scenario>/<framework>/
  vite.config.ts
  speed.bench.ts
  tsconfig.json
  src/
    router.tsx
    routes/
    routeTree.gen.ts

Each scenario uses one app per framework instead of sharing routes in the baseline app. This keeps route-tree size, middleware, Start options, and generated route trees isolated so one scenario cannot shift another scenario's numbers. The existing baseline apps and bench names stay stable for CodSpeed continuity.

Scenario Responsibilities

Each scenario isolates one Start server-side responsibility so benchmark changes can be attributed to a specific feature area.

Scenario Start server-side responsibility
react/, solid/, vue/ baseline apps Document SSR for nested file routes, route matching, search parsing, and full-page HTML response generation.
assets Per-request asset pipeline work: CSS inlining, CDN asset URL transforms with uncached manifest resolution, and response Link header collection for early hints.
before-load Nested beforeLoad execution: sequential per-match context building, context merging across matches, and context consumption by loaders during document SSR.
control-flow Loader-thrown redirect, notFound, plain errors, unmatched routes, and route headers() emission, including HTTP status selection, redirect location headers, route error boundaries, and not-found HTML rendering.
global-middleware Global createStart middleware registration: request middleware wrapping document SSR, server-function, and server-route requests, plus global function middleware on server functions.
head Nested route head evaluation, title/meta/link serialization, and head-entry deduplication during SSR.
loaders Nested route loader execution, loader deps from search params, router context reads, and dehydrated loader payload generation.
rewrites Composed location rewrites from router basepath plus locale input/output rewrites; unprefixed URLs redirect to /app/* when the basepath output rewrite canonicalizes them.
serialization Dehydration and RPC serialization of rich non-plain-JSON types: seroval native types in loader payloads, custom serialization adapters, and shallow-error serialization.
selective-ssr Route-level ssr modes: rendered server HTML with ssr: true, dehydrated data without HTML with ssr: 'data-only', and client-only omission with ssr: false.
server-fn-transport Non-JSON server-function transport: multipart/FormData request decoding, raw Response returns, and RawStream streamed responses through the binary frame protocol.
server-fns createServerFn GET/POST request handling, thrown redirect/notFound results, sendContext serialization, SSR-time direct calls, middleware context, input validation, and URL discovery.
server-routes File route server.handlers dispatch for parameterized JSON API routes without document HTML rendering.
server-routes-middleware Server route request middleware chains, middleware-provided context merging, and handler access to accumulated context.
streaming Deferred loader data, Await/Suspense fallback output, larger streamed HTML body scanning, streamed HTML ordering, and later dehydration payload emission.

Run

Run all benchmarks through Nx so dependency builds are part of the graph:

pnpm nx run @benchmarks/ssr:test:perf --outputStyle=stream --skipRemoteCache

Run framework-specific benchmarks:

pnpm nx run @benchmarks/ssr:test:perf:react --outputStyle=stream --skipRemoteCache
pnpm nx run @benchmarks/ssr:test:perf:solid --outputStyle=stream --skipRemoteCache
pnpm nx run @benchmarks/ssr:test:perf:vue --outputStyle=stream --skipRemoteCache

Build framework-specific benchmark apps:

pnpm nx run @benchmarks/ssr:build:react --outputStyle=stream --skipRemoteCache
pnpm nx run @benchmarks/ssr:build:solid --outputStyle=stream --skipRemoteCache
pnpm nx run @benchmarks/ssr:build:vue --outputStyle=stream --skipRemoteCache

Typecheck benchmark sources:

pnpm nx run @benchmarks/ssr:test:types --outputStyle=stream --skipRemoteCache

Run one scenario app manually through Nx:

pnpm nx run @benchmarks/ssr-<scenario>-<framework>:build:ssr --outputStyle=stream --skipRemoteCache
pnpm nx run @benchmarks/ssr-<scenario>-<framework>:test:types:ssr --outputStyle=stream --skipRemoteCache

Use react, solid, or vue for <framework>. The baseline projects use @benchmarks/ssr-<framework> without a scenario segment.

Request Conventions

  • Document GET loops use accept: text/html, matching the baseline request shape.
  • Server-function loops must include sec-fetch-site: same-origin so the default CSRF middleware accepts the request.
  • Loops that expect non-200 responses pass a custom validateResponse to runRequestLoop.
  • Bench loops must build deterministic requests from the seeded random helper and consume response bodies through runRequestLoop or runSsrRequestLoop.