diff --git a/.changeset/brave-pans-create.md b/.changeset/brave-pans-create.md
deleted file mode 100644
index 0411cdfa59..0000000000
--- a/.changeset/brave-pans-create.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-Update to beta.4
diff --git a/.changeset/brown-breads-begin.md b/.changeset/brown-breads-begin.md
deleted file mode 100644
index 0c54b09096..0000000000
--- a/.changeset/brown-breads-begin.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-Fix two related issues with HeadContent in solid-router
diff --git a/.changeset/bump-solid-query-beta-5.md b/.changeset/bump-solid-query-beta-5.md
deleted file mode 100644
index 270f7bf30f..0000000000
--- a/.changeset/bump-solid-query-beta-5.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
----
-
-Upgrade `@tanstack/solid-query` to `6.0.0-beta.5`
diff --git a/.changeset/bump-solid-query-rc-4.md b/.changeset/bump-solid-query-rc-4.md
deleted file mode 100644
index 016ce240fc..0000000000
--- a/.changeset/bump-solid-query-rc-4.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
----
-
-Upgrade `@tanstack/solid-query` to `6.0.0-rc.4`
diff --git a/.changeset/bump-solid-rc-16.md b/.changeset/bump-solid-rc-16.md
deleted file mode 100644
index 64a1880fa1..0000000000
--- a/.changeset/bump-solid-rc-16.md
+++ /dev/null
@@ -1,14 +0,0 @@
----
-'@tanstack/solid-router': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-start': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
----
-
-Bump solid-js and @solidjs/web to ^2.0.0-rc.16 and @solidjs/vite-plugin to ^3.0.0-next.51 across the monorepo (with @solidjs/babel-plugin 2.0.0-rc.16 for the webpack path and the `@rsbuild/plugin-solid` compiler overrides), and raise the Solid packages' solid-js / @solidjs/web peer floors to 2.0.0-rc.16. @solidjs/vite-plugin 3.0.0-next.51 peer-requires rc.16 and no longer adds a `$$moduleUrl` export to SSR entry chunks, which Cloudflare Workers rejected (solidjs/solid-vite-plugin#423).
-
-Bump @tanstack/solid-query to ^6.0.0-rc.5 and move @tanstack/solid-query-devtools off its exact 6.0.0-rc.1 pin to ^6.0.0-rc.5; every solid-js export the rc.5 devtools import exists in rc.16.
-
-`` no longer renders its children with `undefined` data while hydrating a streamed deferred promise. seroval has already settled the promise by then, but `defer()` only records the result in a `.then` callback, so `` now reads seroval's synchronous status markers when the deferred state is still pending.
diff --git a/.changeset/bump-solid-rc-2.md b/.changeset/bump-solid-rc-2.md
deleted file mode 100644
index 875876dc38..0000000000
--- a/.changeset/bump-solid-rc-2.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-start': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
----
-
-Bump solid-js and @solidjs/web to ^2.0.0-rc.2 and @solidjs/vite-plugin to ^3.0.0-next.32 across the monorepo.
diff --git a/.changeset/bump-solid-rc-20.md b/.changeset/bump-solid-rc-20.md
deleted file mode 100644
index 7db54eb07c..0000000000
--- a/.changeset/bump-solid-rc-20.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-start': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
----
-
-Bump solid-js and @solidjs/web to ^2.0.0-rc.20 and @solidjs/vite-plugin to ^3.0.0-next.54 across the monorepo (with @solidjs/babel-plugin 2.0.0-rc.20 for the webpack path and the `@rsbuild/plugin-solid` compiler overrides), and raise the Solid packages' solid-js / @solidjs/web peer floors to 2.0.0-rc.20.
diff --git a/.changeset/bump-solid-rc-4.md b/.changeset/bump-solid-rc-4.md
deleted file mode 100644
index 079673ee61..0000000000
--- a/.changeset/bump-solid-rc-4.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-start': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
----
-
-Bump solid-js and @solidjs/web to ^2.0.0-rc.4 and @solidjs/vite-plugin to ^3.0.0-next.35 across the monorepo.
diff --git a/.changeset/bump-solid-rc-6.md b/.changeset/bump-solid-rc-6.md
deleted file mode 100644
index b7f8375097..0000000000
--- a/.changeset/bump-solid-rc-6.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-start': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
----
-
-Bump solid-js, @solidjs/web, and @solidjs/signals to ^2.0.0-rc.6 across the monorepo. rc.6 provides the named flight-data source API (registerFlightDataSource / two-argument subscribeFlightData) that the Start single-flight integration now requires; @tanstack/solid-start's peer floor moves to rc.6 accordingly.
diff --git a/.changeset/bump-solid-rc-8.md b/.changeset/bump-solid-rc-8.md
deleted file mode 100644
index 41a0a604db..0000000000
--- a/.changeset/bump-solid-rc-8.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-start': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
----
-
-Bump solid-js and @solidjs/web to ^2.0.0-rc.8 and @solidjs/vite-plugin to ^3.0.0-next.43 across the monorepo (with @rsbuild/plugin-solid ^2.0.0-rc.0 and @solidjs/babel-plugin ^2.0.0-rc.8 for the rsbuild/webpack paths). rc.8 is ESM-only and declares `engines.node >= 22.12`. @solidjs/vite-plugin 3.0.0-next.43 is the first release that honors `resolve.noExternal` patterns when it externalizes the dependencies of packages that consume the Solid runtime (solidjs/solid-vite-plugin#360); on next.41 and next.42, `vite dev` fails for TanStack Start apps with "Package import specifier '#tanstack-router-entry' is not defined".
diff --git a/.changeset/bump-solid-rc-9.md b/.changeset/bump-solid-rc-9.md
deleted file mode 100644
index bad75b7481..0000000000
--- a/.changeset/bump-solid-rc-9.md
+++ /dev/null
@@ -1,14 +0,0 @@
----
-'@tanstack/solid-router': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-start': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
----
-
-Bump solid-js and @solidjs/web to ^2.0.0-rc.9 and @solidjs/vite-plugin to ^3.0.0-next.44 across the monorepo (with @solidjs/babel-plugin 2.0.0-rc.9 for the webpack path). @solidjs/vite-plugin 3.0.0-next.44 peer-requires solid-js ^2.0.0-rc.9 and ships the rc.9 compiler.
-
-rc.9 changed `serverFunctionUrl` to describe a `GET()` reference's own call (`serverFunctionUrl(fn, ...args)`) and moved the id-based form-post address to `serverFunctionActionUrl` / `parseServerFunctionActionUrl` (solidjs/solid#3440); @tanstack/solid-start's server-function handler now uses those.
-
-Rsbuild apps: `@rsbuild/plugin-solid@2.0.0-rc.0` hard-pins the rc.6 compiler, which emits the old delegated-event key (`el.$$click`) that the rc.9 runtime no longer reads (`_$$click`), so delegated handlers never fire. Until the plugin ships an rc.9-based release, override its `@solidjs/compiler` and `@solidjs/babel-plugin` to 2.0.0-rc.9 (the monorepo does this in `pnpm-workspace.yaml`).
diff --git a/.changeset/clever-apples-jog.md b/.changeset/clever-apples-jog.md
deleted file mode 100644
index 279c5ab8d2..0000000000
--- a/.changeset/clever-apples-jog.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-fix: move HydrationScript to HeadContent
diff --git a/.changeset/clever-bears-stand.md b/.changeset/clever-bears-stand.md
deleted file mode 100644
index 1d4eb2d164..0000000000
--- a/.changeset/clever-bears-stand.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade to Solid 2.0.0-beta.5
diff --git a/.changeset/clever-vans-yawn.md b/.changeset/clever-vans-yawn.md
deleted file mode 100644
index 2f2ad97772..0000000000
--- a/.changeset/clever-vans-yawn.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-build: bundle packages with rolldown
diff --git a/.changeset/cruel-tips-shine.md b/.changeset/cruel-tips-shine.md
deleted file mode 100644
index b282563a90..0000000000
--- a/.changeset/cruel-tips-shine.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade to solidjs beta 14
diff --git a/.changeset/cuddly-drinks-count.md b/.changeset/cuddly-drinks-count.md
deleted file mode 100644
index d02d0893b2..0000000000
--- a/.changeset/cuddly-drinks-count.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-chore: sync main to pre-release branch
diff --git a/.changeset/curly-times-sip.md b/.changeset/curly-times-sip.md
deleted file mode 100644
index a7f13c676d..0000000000
--- a/.changeset/curly-times-sip.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade to Solid v2.0.0-beta.6
diff --git a/.changeset/cyan-otters-notice.md b/.changeset/cyan-otters-notice.md
deleted file mode 100644
index c2b84d53fd..0000000000
--- a/.changeset/cyan-otters-notice.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade to solid v2 beta 10
diff --git a/.changeset/evil-parrots-end.md b/.changeset/evil-parrots-end.md
deleted file mode 100644
index 6f7116a6c4..0000000000
--- a/.changeset/evil-parrots-end.md
+++ /dev/null
@@ -1,6 +0,0 @@
----
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-Bump to solid js 2.0.0-beta.3
diff --git a/.changeset/fuzzy-peas-sneeze.md b/.changeset/fuzzy-peas-sneeze.md
deleted file mode 100644
index 95bd1c048d..0000000000
--- a/.changeset/fuzzy-peas-sneeze.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-Update to solid v2 beta 8
diff --git a/.changeset/hot-pillows-bathe.md b/.changeset/hot-pillows-bathe.md
deleted file mode 100644
index f6b3bf8463..0000000000
--- a/.changeset/hot-pillows-bathe.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-chore: bump solid 2 to beta.7
diff --git a/.changeset/load-flight-target.md b/.changeset/load-flight-target.md
deleted file mode 100644
index ab03351452..0000000000
--- a/.changeset/load-flight-target.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-New `loadFlightTarget` helper (exported from `@tanstack/solid-router/ssr/server`): the router's half of a single-flight refresh. Given the mutation request's target href, it builds a router for that location, loads it, and returns the dehydrated payload for the `tsr` flight-data slice, so server collectors can refresh router state alongside other caches on the same mutation response.
diff --git a/.changeset/modern-islands-enjoy.md b/.changeset/modern-islands-enjoy.md
deleted file mode 100644
index 2d8953740d..0000000000
--- a/.changeset/modern-islands-enjoy.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-fix: pin solid 2 beta.6 due to server range with -experimental tag
diff --git a/.changeset/named-flight-source.md b/.changeset/named-flight-source.md
deleted file mode 100644
index ec82099738..0000000000
--- a/.changeset/named-flight-source.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-start': patch
----
-
-Adopt Solid's multi-source single-flight protocol: the router's flight data (loader/match state, dehydrated data) registers under its own source id (`tsr`), so other caches' slices — e.g. solid-query's `sq` — coexist on the same mutation response instead of competing for a single consumer slot, and a user-supplied `collectFlightData` hook adds data alongside the router's rather than displacing it. Requires solid-js / @solidjs/web 2.0.0-rc.6+ (named flight-data sources).
diff --git a/.changeset/petite-icons-press.md b/.changeset/petite-icons-press.md
deleted file mode 100644
index b33b9eda69..0000000000
--- a/.changeset/petite-icons-press.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
----
-
-chore: bump solid-query to 6.0.0-alpha.1
diff --git a/.changeset/pre.json b/.changeset/pre.json
deleted file mode 100644
index 057a165725..0000000000
--- a/.changeset/pre.json
+++ /dev/null
@@ -1,127 +0,0 @@
-{
- "mode": "pre",
- "tag": "rc",
- "initialVersions": {
- "@tanstack/arktype-adapter": "1.167.0",
- "@tanstack/eslint-plugin-router": "1.162.0",
- "@tanstack/eslint-plugin-start": "0.1.0",
- "@tanstack/history": "1.162.0",
- "@tanstack/nitro-v2-vite-plugin": "1.155.0",
- "@tanstack/react-router": "1.170.19",
- "@tanstack/react-router-devtools": "1.167.1",
- "@tanstack/react-router-ssr-query": "1.167.1",
- "@tanstack/react-start": "1.168.36",
- "@tanstack/react-start-client": "1.168.17",
- "@tanstack/react-start-rsc": "0.1.35",
- "@tanstack/react-start-server": "1.167.24",
- "@tanstack/router-cli": "1.167.22",
- "@tanstack/router-core": "1.171.16",
- "@tanstack/router-devtools": "1.167.1",
- "@tanstack/router-devtools-core": "1.168.1",
- "@tanstack/router-generator": "1.167.22",
- "@tanstack/router-plugin": "1.168.24",
- "@tanstack/router-ssr-query-core": "1.169.1",
- "@tanstack/router-utils": "1.162.2",
- "@tanstack/router-vite-plugin": "1.167.24",
- "@tanstack/solid-router": "2.0.0-beta.30",
- "@tanstack/solid-router-devtools": "2.0.0-beta.25",
- "@tanstack/solid-router-ssr-query": "2.0.0-beta.31",
- "@tanstack/solid-start": "2.0.0-beta.31",
- "@tanstack/solid-start-client": "2.0.0-beta.30",
- "@tanstack/solid-start-server": "2.0.0-beta.30",
- "@tanstack/start-client-core": "1.170.15",
- "@tanstack/start-fn-stubs": "1.162.0",
- "@tanstack/start-plugin-core": "1.171.27",
- "@tanstack/start-server-core": "1.169.19",
- "@tanstack/start-static-server-functions": "1.167.20",
- "@tanstack/start-storage-context": "1.167.18",
- "@tanstack/valibot-adapter": "1.167.0",
- "@tanstack/virtual-file-routes": "1.162.0",
- "@tanstack/vue-router": "1.170.18",
- "@tanstack/vue-router-devtools": "1.167.1",
- "@tanstack/vue-router-ssr-query": "1.167.1",
- "@tanstack/vue-start": "1.168.34",
- "@tanstack/vue-start-client": "1.167.20",
- "@tanstack/vue-start-server": "1.167.24",
- "@tanstack/zod-adapter": "1.167.0"
- },
- "changesets": [
- "brave-pans-create",
- "brown-breads-begin",
- "bump-solid-query-beta-5",
- "bump-solid-query-rc-4",
- "bump-solid-rc-16",
- "bump-solid-rc-2",
- "bump-solid-rc-20",
- "bump-solid-rc-4",
- "bump-solid-rc-6",
- "bump-solid-rc-8",
- "bump-solid-rc-9",
- "clever-apples-jog",
- "clever-bears-stand",
- "clever-vans-yawn",
- "cruel-tips-shine",
- "cuddly-drinks-count",
- "curly-times-sip",
- "cyan-otters-notice",
- "evil-parrots-end",
- "fuzzy-peas-sneeze",
- "hot-pillows-bathe",
- "load-flight-target",
- "modern-islands-enjoy",
- "named-flight-source",
- "petite-icons-press",
- "proxy-free-link-props",
- "quiet-shrimps-jam",
- "retire-solid-router-ssr-query",
- "shaky-tools-think",
- "silent-streets-camp",
- "smooth-swans-ask",
- "social-mails-sort",
- "social-rules-fold",
- "solid-functions-flight",
- "solid-js-beta-15",
- "solid-js-beta-17",
- "solid-js-beta-18",
- "solid-js-beta-19",
- "solid-js-beta-20",
- "solid-js-beta-21",
- "solid-js-beta-25",
- "solid-js-beta-27",
- "solid-js-beta-29",
- "solid-js-beta-32",
- "solid-js-rc-0",
- "solid-kings-help",
- "solid-lazy-route-components",
- "solid-link-idle-preload-listeners",
- "solid-link-role",
- "solid-match-suspend-ssr-only",
- "solid-native-ssr-transfer",
- "solid-router-dev-ssr-detection",
- "solid-router-no-router-owned-loading-boundaries",
- "solid-router-observe-blocker-interaction",
- "solid-router-observe-first-load-redirect",
- "solid-router-observe-initial-route",
- "solid-router-observe-interaction",
- "solid-router-observe-location-href",
- "solid-router-observe-navigation",
- "solid-router-observe-pending-not-found",
- "solid-router-observe-redirect-hops",
- "solid-router-observe-route-names",
- "solid-router-public-hydration-api",
- "solid-router-server-function-metadata",
- "solid-router-settlement-ack",
- "solid-rsbuild-native-loader",
- "solid-server-fn-abort-signal",
- "solid-usehead-registry",
- "spotty-moons-listen",
- "store-bridge-single-flush",
- "tall-horses-repair",
- "tame-lions-hunt",
- "three-carrots-return",
- "tiny-beds-tan",
- "tired-pants-eat",
- "violet-turkeys-cross",
- "wicked-olives-poke"
- ]
-}
diff --git a/.changeset/proxy-free-link-props.md b/.changeset/proxy-free-link-props.md
deleted file mode 100644
index e0f5879cc3..0000000000
--- a/.changeset/proxy-free-link-props.md
+++ /dev/null
@@ -1,23 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-perf(solid-router): make `useLinkProps` proxy-free in the spread hot path
-
-`useLinkProps` previously layered four proxies (`merge` for defaults, two
-`splitProps`/`omit` proxies, and a final `merge` of spreadable props with the
-resolved props memo). Solid's `spread()` re-enumerated all of them through V8
-proxy traps on every navigation, for every `Link`, which showed up in CodSpeed
-profiles as a large unattributed "NodeJS internals" cost.
-
-`useLinkProps` now returns a plain object with a stable key set whose
-reactivity lives in property getters backed by fine-grained memos. Values that
-no longer apply resolve to `undefined`, which `spread()` treats as attribute
-removal. The built-location memo also gained href-based equality so downstream
-memos skip work when a navigation doesn't change a link's target.
-
-This makes the client-side navigation benchmark ~30% faster.
-
-Note: keys returned by `activeProps`/`inactiveProps` functions are discovered
-once at setup — functions that later return brand-new keys (beyond the initial
-set plus `class`/`style`) won't have those keys applied.
diff --git a/.changeset/quiet-shrimps-jam.md b/.changeset/quiet-shrimps-jam.md
deleted file mode 100644
index 240815ab5c..0000000000
--- a/.changeset/quiet-shrimps-jam.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
----
-
-fix: use solid v2 compatible solid-query
diff --git a/.changeset/retire-solid-router-ssr-query.md b/.changeset/retire-solid-router-ssr-query.md
deleted file mode 100644
index 7603eaeecd..0000000000
--- a/.changeset/retire-solid-router-ssr-query.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
----
-
-Deprecated: Solid Query's `QueryClientProvider` now carries the Router + Query SSR pairing natively (registry hydration, named single-flight sources, redirect handling via userland glue), so this integration package is no longer needed. See the README for the migration.
diff --git a/.changeset/rsbuild-manifest-module-chunks-once.md b/.changeset/rsbuild-manifest-module-chunks-once.md
new file mode 100644
index 0000000000..02febd9d84
--- /dev/null
+++ b/.changeset/rsbuild-manifest-module-chunks-once.md
@@ -0,0 +1,5 @@
+---
+'@tanstack/start-plugin-core': patch
+---
+
+Rsbuild: the Start manifest pass that runs after every client compilation (builds and each dev update) reads an imported module's chunks once per compilation and counts the module once per importing chunk, instead of once per import connection. The manifest is unchanged; the pass takes about 40 % less time (on a 333-route app, tens of milliseconds less per HMR update).
diff --git a/.changeset/rsbuild-manifest-own-chunks.md b/.changeset/rsbuild-manifest-own-chunks.md
new file mode 100644
index 0000000000..04e8e29928
--- /dev/null
+++ b/.changeset/rsbuild-manifest-own-chunks.md
@@ -0,0 +1,5 @@
+---
+'@tanstack/start-plugin-core': patch
+---
+
+Rsbuild: a route's client manifest entry lists only its own chunks and CSS. When two routes shared a module in a chunk of its own, each route's entry also listed the other route's chunk as a preload and its stylesheet.
diff --git a/.changeset/rsbuild-rule-use-falsy-loaders.md b/.changeset/rsbuild-rule-use-falsy-loaders.md
new file mode 100644
index 0000000000..a84a054fbd
--- /dev/null
+++ b/.changeset/rsbuild-rule-use-falsy-loaders.md
@@ -0,0 +1,5 @@
+---
+'@tanstack/start-plugin-core': patch
+---
+
+fix: the Rsbuild RSC integration skips falsy entries in a rule's `use` array (Rspack's conditionally disabled loaders) instead of treating them as loaders.
diff --git a/.changeset/rsbuild-virtual-modules-build.md b/.changeset/rsbuild-virtual-modules-build.md
new file mode 100644
index 0000000000..01a0c5ee6e
--- /dev/null
+++ b/.changeset/rsbuild-virtual-modules-build.md
@@ -0,0 +1,5 @@
+---
+'@tanstack/start-plugin-core': patch
+---
+
+Rsbuild: fix the Rsbuild plugin build after two changes to its virtual modules crossed. Without this fix the package does not build, so no release could ship it. The Rsbuild dev manifest is written to its virtual module under the app's root.
diff --git a/.changeset/rsbuild-virtual-modules-root.md b/.changeset/rsbuild-virtual-modules-root.md
new file mode 100644
index 0000000000..427043a712
--- /dev/null
+++ b/.changeset/rsbuild-virtual-modules-root.md
@@ -0,0 +1,5 @@
+---
+'@tanstack/start-plugin-core': patch
+---
+
+Rsbuild: Start writes its virtual modules under the app's root, not the working directory. An app built or served from another directory (`rsbuild build --root ` from a monorepo root) no longer fails with "Module not found" on the packages they import, such as RSC's serialization adapters.
diff --git a/.changeset/rsc-security-floor.md b/.changeset/rsc-security-floor.md
new file mode 100644
index 0000000000..9c828f13b3
--- /dev/null
+++ b/.changeset/rsc-security-floor.md
@@ -0,0 +1,8 @@
+---
+'@tanstack/react-start-rsc': patch
+---
+
+Raise the minimum RSC bundler peer dependencies to versions with the React Server Components fixes for GHSA-xqc2-xf4c-x3h3 (CVE-2026-126187, unauthenticated RCE) and GHSA-h3gv-c5rc-p453 (server function DoS):
+
+- `@vitejs/plugin-rsc` to `>=0.5.38` (GHSA-59pf-q495-3c99), which vendors a fixed `react-server-dom-webpack`.
+- `react-server-dom-rspack` to `>=0.1.1`, the first release built from React sources that include the fix.
diff --git a/.changeset/shaky-tools-think.md b/.changeset/shaky-tools-think.md
deleted file mode 100644
index 2218cdd8d4..0000000000
--- a/.changeset/shaky-tools-think.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
----
-
-chore: bump solid-query to 6.0.0-alpha.2
diff --git a/.changeset/silent-streets-camp.md b/.changeset/silent-streets-camp.md
deleted file mode 100644
index e2d8144dd7..0000000000
--- a/.changeset/silent-streets-camp.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-fix: adjust pre-release ranges
diff --git a/.changeset/smooth-swans-ask.md b/.changeset/smooth-swans-ask.md
deleted file mode 100644
index bf7ecda35a..0000000000
--- a/.changeset/smooth-swans-ask.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-fix: add vite 8 compat
diff --git a/.changeset/social-mails-sort.md b/.changeset/social-mails-sort.md
deleted file mode 100644
index 77309d35a0..0000000000
--- a/.changeset/social-mails-sort.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': major
-'@tanstack/solid-router-devtools': major
-'@tanstack/solid-start-client': major
-'@tanstack/solid-start-server': major
-'@tanstack/solid-router': major
-'@tanstack/solid-start': major
----
-
-solid v2 pre-release for solid-router and start
diff --git a/.changeset/social-rules-fold.md b/.changeset/social-rules-fold.md
deleted file mode 100644
index 62c77ee9cd..0000000000
--- a/.changeset/social-rules-fold.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-chore: bump solid-query and vite-plugin-solid
diff --git a/.changeset/solid-functions-flight.md b/.changeset/solid-functions-flight.md
deleted file mode 100644
index de272fadd2..0000000000
--- a/.changeset/solid-functions-flight.md
+++ /dev/null
@@ -1,12 +0,0 @@
----
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-start': patch
----
-
-Run Solid Start server functions through the Solid 2 server-function runtime, including request handling, serialization, middleware, direct SSR calls, and no-JS forms.
-
-POST server functions now use Solid 2's single-flight transport to return updated Router loader and hydration data with the mutation response.
diff --git a/.changeset/solid-js-beta-15.md b/.changeset/solid-js-beta-15.md
deleted file mode 100644
index 93e0d17c2a..0000000000
--- a/.changeset/solid-js-beta-15.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade `solid-js` and `@solidjs/web` to `2.0.0-beta.15`
diff --git a/.changeset/solid-js-beta-17.md b/.changeset/solid-js-beta-17.md
deleted file mode 100644
index bfa0012943..0000000000
--- a/.changeset/solid-js-beta-17.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade `solid-js` and `@solidjs/web` to `2.0.0-beta.17`
diff --git a/.changeset/solid-js-beta-18.md b/.changeset/solid-js-beta-18.md
deleted file mode 100644
index be50246023..0000000000
--- a/.changeset/solid-js-beta-18.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade `solid-js` and `@solidjs/web` to `2.0.0-beta.18`
diff --git a/.changeset/solid-js-beta-19.md b/.changeset/solid-js-beta-19.md
deleted file mode 100644
index 9f488348bc..0000000000
--- a/.changeset/solid-js-beta-19.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade `solid-js` and `@solidjs/web` to `2.0.0-beta.19` and `vite-plugin-solid` to `3.0.0-next.11`
diff --git a/.changeset/solid-js-beta-20.md b/.changeset/solid-js-beta-20.md
deleted file mode 100644
index 2f531e0c6a..0000000000
--- a/.changeset/solid-js-beta-20.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade `solid-js` and `@solidjs/web` to `2.0.0-beta.20`
diff --git a/.changeset/solid-js-beta-21.md b/.changeset/solid-js-beta-21.md
deleted file mode 100644
index aeb66b6f90..0000000000
--- a/.changeset/solid-js-beta-21.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade `solid-js` and `@solidjs/web` to `2.0.0-beta.21`
diff --git a/.changeset/solid-js-beta-25.md b/.changeset/solid-js-beta-25.md
deleted file mode 100644
index 934dd8661e..0000000000
--- a/.changeset/solid-js-beta-25.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade `solid-js` and `@solidjs/web` to `2.0.0-beta.25`
diff --git a/.changeset/solid-js-beta-27.md b/.changeset/solid-js-beta-27.md
deleted file mode 100644
index 49ee209768..0000000000
--- a/.changeset/solid-js-beta-27.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade `solid-js` and `@solidjs/web` to `2.0.0-beta.27`
diff --git a/.changeset/solid-js-beta-29.md b/.changeset/solid-js-beta-29.md
deleted file mode 100644
index c9fa2b2729..0000000000
--- a/.changeset/solid-js-beta-29.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade `solid-js` and `@solidjs/web` to `2.0.0-beta.29`
diff --git a/.changeset/solid-js-beta-32.md b/.changeset/solid-js-beta-32.md
deleted file mode 100644
index ad1c5d575b..0000000000
--- a/.changeset/solid-js-beta-32.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade `solid-js` and `@solidjs/web` to `2.0.0-beta.32`
diff --git a/.changeset/solid-js-rc-0.md b/.changeset/solid-js-rc-0.md
deleted file mode 100644
index 59ca0fcbdc..0000000000
--- a/.changeset/solid-js-rc-0.md
+++ /dev/null
@@ -1,16 +0,0 @@
----
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-start': patch
----
-
-Upgrade `solid-js` and `@solidjs/web` to `2.0.0-rc.0`, and migrate from `vite-plugin-solid` to its new name `@solidjs/vite-plugin` at `3.0.0-next.28`
-
-`vite-plugin-solid` was renamed to `@solidjs/vite-plugin`; its final release (`3.0.0-next.27`) is a re-export shim over the new package. `@solidjs/vite-plugin@3.0.0-next.28` requires `solid-js`/`@solidjs/web` `^2.0.0-rc.0`, so the rename and the `rc` bump land together.
-
-`@tanstack/router-plugin` is intentionally untouched: it detects the Solid JSX plugin by its Vite plugin _name_ (`solid`), which the renamed package still registers, and its `vite-plugin-solid` peer is optional — so it keeps working for both Solid 1 and Solid 2 consumers without a change.
-
-Also bumps `@tanstack/solid-query` and `@tanstack/solid-query-devtools` to `^6.0.0-rc.0` (whose peer requires `solid-js >=2.0.0-rc.0`), and converges `@tanstack/query-core` on `5.101.4` — `solid-query` depends on query-core `5.101.0`, which previously resolved to a stale `5.99.0` and produced two incompatible `QueryClient` types.
diff --git a/.changeset/solid-kings-help.md b/.changeset/solid-kings-help.md
deleted file mode 100644
index b638658e9b..0000000000
--- a/.changeset/solid-kings-help.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Upgrade solid refresh, fix deep equal for promises
diff --git a/.changeset/solid-lazy-route-components.md b/.changeset/solid-lazy-route-components.md
deleted file mode 100644
index 7d75969507..0000000000
--- a/.changeset/solid-lazy-route-components.md
+++ /dev/null
@@ -1,17 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-`lazyRouteComponent` now delegates to Solid's `lazy()` using its `{ export }`
-option (solid-js 2.0.0-rc.1): the module namespace passes through untouched,
-so SSR'd route chunks resolve their client assets (stylesheet links,
-modulepreload hints, hydration gating) through the client-assets manifest,
-and hydration claims the component synchronously from the preloaded module.
-Failed chunk downloads are retried by the next preload or render, and the
-module-not-found reload-once behavior is unchanged. Solid packages are
-bumped to the 2.0.0-rc.1 line (`@solidjs/vite-plugin` 3.0.0-next.30).
diff --git a/.changeset/solid-link-idle-preload-listeners.md b/.changeset/solid-link-idle-preload-listeners.md
deleted file mode 100644
index 345c56f777..0000000000
--- a/.changeset/solid-link-idle-preload-listeners.md
+++ /dev/null
@@ -1,18 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Stop installing intent-preload listeners on ` ` when intent preloading is off.
-
-`useLinkProps` handed out `onFocus`/`onBlur`/`onMouseEnter`/`onMouseLeave` (and the
-mouse-over/out/touch-start pair) unconditionally, with the `preload() !== 'intent'`
-check living _inside_ each handler. Solid does not delegate `mouseenter`,
-`mouseleave`, `focus` or `blur`, so every anchor installed four real listeners that
-did nothing but return — on a list view that is four per row (a 165-row board
-measured 660 listeners whose only job was to bail).
-
-The handlers are now resolved through getters: with intent preloading off the
-property yields whatever the consumer passed (or `undefined`, which `spread()`
-treats as removal), and nothing is attached. Behaviour is unchanged — the getters
-stay reactive, so flipping `preload` back to `'intent'` re-runs the consuming
-spread and attaches the composed handler.
diff --git a/.changeset/solid-link-role.md b/.changeset/solid-link-role.md
deleted file mode 100644
index b66e1c1dc6..0000000000
--- a/.changeset/solid-link-role.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Preserve caller-provided roles on enabled links.
diff --git a/.changeset/solid-match-suspend-ssr-only.md b/.changeset/solid-match-suspend-ssr-only.md
deleted file mode 100644
index c83ea61355..0000000000
--- a/.changeset/solid-match-suspend-ssr-only.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Suspend on the match `loadPromise` only during SSR. On the client, suspending on the pending match kept a live async source in the tree, which since `solid-js@2.0.0-beta.16` routed signal writes into a transition hold and broke synchronous write-then-load flows such as `invalidate()` on a `notFound` match.
diff --git a/.changeset/solid-native-ssr-transfer.md b/.changeset/solid-native-ssr-transfer.md
deleted file mode 100644
index 08093414b6..0000000000
--- a/.changeset/solid-native-ssr-transfer.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Native SSR state transfer for Solid: router match state (loaderData, beforeLoad context, status, errors) now rides Solid's hydration registry under `tsr:` keys instead of a bespoke bootstrap script, deferred `loaderData` promises stream natively via seroval, the client primes router state from the registry in the Router constructor (before any render context, eliminating boot-time refetches and `bootLoad`-style workarounds), and `RouterProvider` owns the server-side `router.load()` dispatch so server entries no longer await it manually.
diff --git a/.changeset/solid-router-dev-ssr-detection.md b/.changeset/solid-router-dev-ssr-detection.md
deleted file mode 100644
index 21530ba043..0000000000
--- a/.changeset/solid-router-dev-ssr-detection.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Fall back to the router instance's server flag during development SSR. This prevents router construction from entering client hydration on the server and restores provider-owned loading and match-state serialization.
diff --git a/.changeset/solid-router-no-router-owned-loading-boundaries.md b/.changeset/solid-router-no-router-owned-loading-boundaries.md
deleted file mode 100644
index 4baa6d86b6..0000000000
--- a/.changeset/solid-router-no-router-owned-loading-boundaries.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Remove all router-owned `Loading` boundaries from `Matches`, `Match`, and `Outlet`, and only install one in `Await` when a `fallback` is provided. Async reads in route components are no longer caught by an invisible router boundary, so Solid's implicit transitions hold the previous view — live and interactive — until the new route settles, then swap atomically. `pendingComponent` is presented through router pending state (`pendingMs`/`pendingMinMs`) as before; loading boundaries are now exclusively user-provided.
diff --git a/.changeset/solid-router-observe-blocker-interaction.md b/.changeset/solid-router-observe-blocker-interaction.md
deleted file mode 100644
index 82b952637b..0000000000
--- a/.changeset/solid-router-observe-blocker-interaction.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Observe tier (Solid's dev and observe builds only): a navigation that passes a `useBlocker` keeps the interaction that requested it and is dated from the request, though the history awaits the blocker before it changes; one the blocker holds until `proceed()` joins the interaction that proceeds and is dated from it, as `@solidjs/router`'s `retry()` makes it. The router notes the request at `commitLocation` for the history change to take. A navigation the blocker stops, or a request that changes no history (the same location reloading), leaves nothing noted behind. Nothing changes in production, where `OBSERVE` is undefined.
diff --git a/.changeset/solid-router-observe-first-load-redirect.md b/.changeset/solid-router-observe-first-load-redirect.md
deleted file mode 100644
index a70d283c45..0000000000
--- a/.changeset/solid-router-observe-first-load-redirect.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Observe tier (Solid's dev and observe builds only): a redirect while the first page loads — a client-rendered arrival whose `beforeLoad` or loader throws `redirect()` — is recorded as a navigation from the arrival to where the redirect sent it, after the initial record that names the arrival, as `@solidjs/router` records one. It had no record: nothing was shown yet to navigate from. Nothing changes in production, where `OBSERVE` is undefined.
diff --git a/.changeset/solid-router-observe-initial-route.md b/.changeset/solid-router-observe-initial-route.md
deleted file mode 100644
index fe61ae8df2..0000000000
--- a/.changeset/solid-router-observe-initial-route.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Observe tier (Solid's dev and observe builds only): the router declares the route the document arrived on, with the same `OBSERVE.attribution.withOrigin` call it makes for every navigation (`initial: true` on the ref), around the work that establishes its initial match — the Transitioner's on the client, `RouterProvider`'s load on the server. On the client this is the first `"navigation"` record (`initial: true`, `at` the document's navigation start, no write to wait for), kept out of `feedback().navigations`; on the server the same declaration names the request's `"render"` record (`RenderEvent.route`: the matched route's `fullPath`, the path and search, the params), read when the render settles, so a render whose provider ran the load names the location it resolved. A consumer naming page loads and requests by route (`/users/$id` rather than one name per user) had this for every navigation but the first; now it has the first too.
-
-The Transitioner committing the canonical form of the arrival location (search defaults, trailing slash) is part of the arrival, as in `@solidjs/router`: the initial record names the canonical location, a router loaded before it mounted no longer records the commit as a navigation, and the next navigation is dated from its own request rather than from that commit. Nothing changes in production, where `OBSERVE` is undefined.
diff --git a/.changeset/solid-router-observe-interaction.md b/.changeset/solid-router-observe-interaction.md
deleted file mode 100644
index c10135c4e9..0000000000
--- a/.changeset/solid-router-observe-interaction.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Observe tier (Solid's dev and observe builds only): a navigation's record joins the interaction that requested it — the ` ` click, or any handler that called `navigate()` — though the match publish it wraps runs after the loaders, long after the handler returned. The Transitioner captures `OBSERVE.attribution.currentOrigin()` with the request time when the history changes and hands it back as `NavigationRef.interaction` (solid-js 2.0.0-rc.12), so the record, and every hold and re-run the publish causes, carries the click. A navigation requested outside any interaction declares none. Nothing changes in production, where `OBSERVE` is undefined.
diff --git a/.changeset/solid-router-observe-location-href.md b/.changeset/solid-router-observe-location-href.md
deleted file mode 100644
index fc320dadcf..0000000000
--- a/.changeset/solid-router-observe-location-href.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Observe tier (Solid's dev and observe builds only): a navigation's `to` and `from`, the initial record's `to`, and a server render's `RenderEvent.route.to` are the location's path, search and hash (`/users/42?tab=posts#bio`) rather than its pathname, as `@solidjs/router` gives them — its `href`, in the router's own path space, the one `name` is in (before a basepath or rewrite). A request carries no hash, so a render's `to` is the path and search. The name stays the route pattern the pathname matches. Nothing changes in production, where `OBSERVE` is undefined.
diff --git a/.changeset/solid-router-observe-navigation.md b/.changeset/solid-router-observe-navigation.md
deleted file mode 100644
index 78147b945b..0000000000
--- a/.changeset/solid-router-observe-navigation.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Declare navigations to Solid's observe tier. On Solid's dev and observe builds (`OBSERVE` defined), the match publish inside `startTransition` is wrapped in `OBSERVE.attribution.withOrigin` with the destination route's `fullPath`, params, `to`/`from` pathnames and `at` from the history change that started the load, so the holds and re-runs a navigation causes are named after the route and the record spans the loader wait. The pending offer, the initial load and same-location reloads are published undeclared. Nothing changes in production, where `OBSERVE` is undefined.
diff --git a/.changeset/solid-router-observe-pending-not-found.md b/.changeset/solid-router-observe-pending-not-found.md
deleted file mode 100644
index 24096baee0..0000000000
--- a/.changeset/solid-router-observe-pending-not-found.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Observe tier (Solid's dev and observe builds only): a not-found under a route with a loader (`/users/2/nope` under `/users/$id`) is recorded, named by its pathname, as `@solidjs/router` records an unmatched path. The route's match sits below the not-found boundary and never loads, so it stays `pending` in the publish that lands, which was mistaken for the pending offer and published undeclared: the navigation had no record. Only a match pending at or above the not-found boundary marks the pending offer now. Nothing changes in production, where `OBSERVE` is undefined.
diff --git a/.changeset/solid-router-observe-redirect-hops.md b/.changeset/solid-router-observe-redirect-hops.md
deleted file mode 100644
index e5ae7fd166..0000000000
--- a/.changeset/solid-router-observe-redirect-hops.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Observe tier (Solid's dev and observe builds only): a navigation sent elsewhere while it is pending — a `beforeLoad` or loader redirecting it, or another navigation requested before it published — is one record with its hops, as `@solidjs/router` declares one: the record keeps the first request's time and interaction, names the destination that showed, and lists the destinations it abandoned in `redirects` (each with its name, `to`, params, and when it was sent on). The router declares a `redirect: n` ref per hop around the publish that lands. The browser moving (back, forward) while a navigation is pending supersedes it instead: a record of its own, from the location shown. Before, the record named only the final destination and kept no hops. Nothing changes in production, where `OBSERVE` is undefined.
diff --git a/.changeset/solid-router-observe-route-names.md b/.changeset/solid-router-observe-route-names.md
deleted file mode 100644
index 2313b52dd6..0000000000
--- a/.changeset/solid-router-observe-route-names.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Observe tier (Solid's dev and observe builds only): a navigation's record names a not-found by its pathname instead of the route above it, so `/nope` no longer files under `/` beside the home page, and its `params` are the strings the path bound rather than the values `params.parse` returned, as Solid's `NavigationRef` declares them. Nothing changes in production, where `OBSERVE` is undefined.
diff --git a/.changeset/solid-router-public-hydration-api.md b/.changeset/solid-router-public-hydration-api.md
deleted file mode 100644
index d0249f5d6d..0000000000
--- a/.changeset/solid-router-public-hydration-api.md
+++ /dev/null
@@ -1,12 +0,0 @@
----
-'@tanstack/solid-router': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-start': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
----
-
-Bump solid-js and @solidjs/web to ^2.0.0-rc.13 (and @solidjs/vite-plugin to ^3.0.0-next.46), and raise the Solid peer floors to 2.0.0-rc.13.
-
-@tanstack/solid-router moves off Solid's internal `sharedConfig` and the raw `_$HY` registry onto the public hydration API rc.13 ships (solidjs/solid#3718): `useHydrated` reads `isHydrating()`; the native SSR match transfer writes through `getHydrationWriter()` gated on `isHydratable()`, so it now respects ``; and the client boot takes each match's entry with `takeHydrationValue()`.
diff --git a/.changeset/solid-router-server-function-metadata.md b/.changeset/solid-router-server-function-metadata.md
deleted file mode 100644
index 10995632ba..0000000000
--- a/.changeset/solid-router-server-function-metadata.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Consume Solid server-function response metadata. `RouterContextProvider` registers the router as the transport's unnamed single-flight consumer on the client, so the response helpers a mutation returns take effect without the caller wrapping the call: `redirect()` navigates — same-origin targets softly under the router with `replace`, other origins through a document navigation via `navigate({ href })` so the protocol allowlist and blockers still apply — and any declaration of a write (`redirect()`, `reload({ revalidate })`, `respond(value, { revalidate })`, the reserved `revalidate: '*'`) reloads route data through `router.invalidate()`. An empty declaration (`revalidate: []`) is honored as nothing to reload. Navigation runs before invalidation so a redirect costs one load: the destination commits with its shared layouts reloaded and the page being left never reruns its own loaders. `X-Revalidate` keys name entries in caches the router does not own and are left to those caches' consumers.
diff --git a/.changeset/solid-router-settlement-ack.md b/.changeset/solid-router-settlement-ack.md
deleted file mode 100644
index c7133af16a..0000000000
--- a/.changeset/solid-router-settlement-ack.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Resolve the `router.startTransition` render acknowledgement when the commit's transition actually settles instead of immediately after flush. View transitions, `onRendered` (scroll restoration), pending minimum-display timing, and `status: 'idle'` now observe the committed swap instead of firing against held DOM; superseded or rolled-back commits acknowledge `false` instead of leaking. Synchronous navigations still acknowledge within the same flush.
diff --git a/.changeset/solid-rsbuild-native-loader.md b/.changeset/solid-rsbuild-native-loader.md
deleted file mode 100644
index 8532432e66..0000000000
--- a/.changeset/solid-rsbuild-native-loader.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-start': patch
----
-
-Patch @rsbuild/plugin-solid's native `solid` loader options for SSR builds. Since 2.0.0-beta.1 the plugin compiles through its own loader (native compiler by default) instead of registering babel-preset-solid, so the babel preset patch never fired and node-target bundles were compiled in dom mode, crashing at import with "Client-only API called on the server side". The rsbuild start plugin now patches the loader's `solid` options (`generate: 'ssr'` on node targets, `hydratable: true`) alongside the legacy babel preset patch.
diff --git a/.changeset/solid-server-fn-abort-signal.md b/.changeset/solid-server-fn-abort-signal.md
deleted file mode 100644
index f6f9202526..0000000000
--- a/.changeset/solid-server-fn-abort-signal.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-start': patch
----
-
-Support per-call AbortSignals for Solid server functions. solid-js 2.0.0-rc.4 added the per-call invocation channel (`invoke(fn, { signal }, ...args)`) and moved server function id resolution from the `X-Server-Function` header to the request url pathname; the client rpc now rides that channel when a `signal` is passed to a server function, and the server handler resolves/normalizes ids via the url. The previously skipped abort e2e tests are re-enabled.
diff --git a/.changeset/solid-usehead-registry.md b/.changeset/solid-usehead-registry.md
deleted file mode 100644
index 9af2b378e0..0000000000
--- a/.changeset/solid-usehead-registry.md
+++ /dev/null
@@ -1,19 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-Register head tags through Solid's `useHead` registry. `HeadContent` now
-feeds the route-derived tags to Solid's head registry as one reactive group
-instead of rendering elements in-tree: the registry owns head emission on
-both runtimes (SSR splicing/streaming and client-side patching), replacing
-the manual relocate-into-head, imperative script injection, and
-`document.title` syncing. Inline scripts and styles carry a stable
-content-derived key so server and client reconcile on the same identity.
-`HeadContent` can now be rendered anywhere in the tree. The dedicated
-development entry (`index.dev`) and its `development` export conditions are
-retired along with it.
diff --git a/.changeset/spotty-moons-listen.md b/.changeset/spotty-moons-listen.md
deleted file mode 100644
index e2d8cc318b..0000000000
--- a/.changeset/spotty-moons-listen.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-fix: keep route-scoped accessors (e.g. `Route.useParams()`, `Route.useSearch()`) readable when read from async work after navigating away. Once the owning scope is disposed, the accessor returns its last known value instead of `undefined` for the now-missing match.
diff --git a/.changeset/start-server-fn-custom-id-check.md b/.changeset/start-server-fn-custom-id-check.md
new file mode 100644
index 0000000000..384f0ade06
--- /dev/null
+++ b/.changeset/start-server-fn-custom-id-check.md
@@ -0,0 +1,7 @@
+---
+'@tanstack/start-plugin-core': minor
+---
+
+A server function id that a custom `serverFns.generateFunctionId` returns and that never worked over HTTP now fails the build, with an error naming the file, the function and the id: whitespace, a control or non-ASCII character, any of `"`, `#`, `/`, `<`, `>`, `?`, `\`, `^`, `` ` ``, `{`, `}`, the ids `.` and `..`, and a percent-encoding the server reads as another id (`%41`, lowercase hex, `%2E`) or rejects. The client puts the id in the URL unencoded, so a `#` or `?` ended the path and a `/` cut the id short (the call silently ran another server function of the file or none), and the other characters reached the server percent-encoded and matched no function. An id embedding a non-ASCII `functionName` is one of these. One case did work and now fails the build: such an id on a server function only SSR code called.
+
+Ids with `%` or the other characters URLs allow (such as `:`, `@`, `+`, `=`, `,`, `;`, `!`, `*`, `(`, `)`, `&`, `'`, `|`, `[`, `]`) still build and reach their handler, with a deprecation warning (from the Vite plugin; the Rsbuild plugin does not print compiler warnings yet): the next major version rejects them, since proxies and servers may decode or rewrite them (hash the inputs instead, as the documented example does). An id with `'` no longer breaks the server bundle.
diff --git a/.changeset/start-vite-root-library-discovery.md b/.changeset/start-vite-root-library-discovery.md
new file mode 100644
index 0000000000..d4e8221c59
--- /dev/null
+++ b/.changeset/start-vite-root-library-discovery.md
@@ -0,0 +1,5 @@
+---
+'@tanstack/start-plugin-core': patch
+---
+
+Vite: Start finds the Start libraries it bundles in the SSR build from Vite's root, not the working directory. A `vite build ` run from another directory (a monorepo root, a script) no longer leaves them external and uncompiled, where their server fns returned `undefined`.
diff --git a/.changeset/store-bridge-single-flush.md b/.changeset/store-bridge-single-flush.md
deleted file mode 100644
index 0a63beb57f..0000000000
--- a/.changeset/store-bridge-single-flush.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Stop force-flushing Solid's scheduler on every router-core batch. Store writes now coalesce through the scheduler (one settle per navigation instead of 3-5 full synchronous flushes) while reads stay synchronously fresh via a shadow value in the store bridge.
diff --git a/.changeset/tall-horses-repair.md b/.changeset/tall-horses-repair.md
deleted file mode 100644
index 295b9e819d..0000000000
--- a/.changeset/tall-horses-repair.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-fix: use TSR_DEFERRED_PROMISE
diff --git a/.changeset/tame-lions-hunt.md b/.changeset/tame-lions-hunt.md
deleted file mode 100644
index d54795134a..0000000000
--- a/.changeset/tame-lions-hunt.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router': patch
----
-
-Fix hydration desync by resolving `defaultNotFoundComponent` at render time instead of lazily mutating the boundary route's `options.notFoundComponent`. Route objects are module singletons shared across server requests, so once the server handled any 404, later SSRs of valid URLs wrapped the match in a `CatchNotFound` boundary the client didn't render, shifting hydration keys and leaving the subtree inert.
diff --git a/.changeset/three-carrots-return.md b/.changeset/three-carrots-return.md
deleted file mode 100644
index bd8daa172e..0000000000
--- a/.changeset/three-carrots-return.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-bump to alpha.1
diff --git a/.changeset/tiny-beds-tan.md b/.changeset/tiny-beds-tan.md
deleted file mode 100644
index fb8bca1450..0000000000
--- a/.changeset/tiny-beds-tan.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-sync main
diff --git a/.changeset/tired-pants-eat.md b/.changeset/tired-pants-eat.md
deleted file mode 100644
index d4a071c298..0000000000
--- a/.changeset/tired-pants-eat.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-start': patch
----
-
-fix: better rollupOptions/rolldownOptions handling
diff --git a/.changeset/violet-turkeys-cross.md b/.changeset/violet-turkeys-cross.md
deleted file mode 100644
index b095b45e58..0000000000
--- a/.changeset/violet-turkeys-cross.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
-'@tanstack/solid-router-devtools': patch
-'@tanstack/solid-start-client': patch
-'@tanstack/solid-start-server': patch
-'@tanstack/solid-router': patch
-'@tanstack/solid-start': patch
----
-
-chore: sync main branch with store refactor
diff --git a/.changeset/wicked-olives-poke.md b/.changeset/wicked-olives-poke.md
deleted file mode 100644
index 479ea10d53..0000000000
--- a/.changeset/wicked-olives-poke.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/solid-router-ssr-query': patch
----
-
-fix: use solid-query 6.0.0-alpha.0
diff --git a/.coderabbit.yaml b/.coderabbit.yaml
new file mode 100644
index 0000000000..21d884dbeb
--- /dev/null
+++ b/.coderabbit.yaml
@@ -0,0 +1,12 @@
+# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
+
+reviews:
+ request_changes_workflow: false
+ slop_detection:
+ enabled: true
+
+knowledge_base:
+ code_guidelines:
+ enabled: true
+ filePatterns:
+ - 'CONTRIBUTING.md'
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index a33150af03..9dd0def7bd 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -4,6 +4,14 @@ body:
- type: markdown
attributes:
value: |
+
+
Thank you for reporting an issue :pray:.
This issue tracker is for reporting bugs found in TanStack Router and/or Start.
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
new file mode 100644
index 0000000000..a5ef10f1ff
--- /dev/null
+++ b/.github/pull_request_template.md
@@ -0,0 +1,22 @@
+## 🎯 Changes
+
+
+
+## ✅ Checklist
+
+- [ ] I have followed the steps in the [Contributing guide](https://github.com/TanStack/router/blob/main/CONTRIBUTING.md).
+- [ ] I have tested code changes locally with the relevant test commands, or tests do not apply to this pull request.
+- [ ] I fully understand the code in this pull request, including any code generated with AI assistance.
+
+## 🚀 Release Impact
+
+- [ ] This change affects published code, and I have generated a [changeset](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md).
+- [ ] This change is docs/CI/dev-only (no release).
+
+
diff --git a/.github/renovate.json b/.github/renovate.json
index 01be1ce5c2..6fd5aa1c86 100644
--- a/.github/renovate.json
+++ b/.github/renovate.json
@@ -21,7 +21,6 @@
"@types/node",
"@types/react",
"@types/react-dom",
- "h3",
"node",
"react",
"react-dom",
diff --git a/.github/workflows/client-nav-benchmarks.yml b/.github/workflows/benchmarks.yml
similarity index 88%
rename from .github/workflows/client-nav-benchmarks.yml
rename to .github/workflows/benchmarks.yml
index 8715312d36..bbc3a1fa24 100644
--- a/.github/workflows/client-nav-benchmarks.yml
+++ b/.github/workflows/benchmarks.yml
@@ -18,9 +18,18 @@ on:
pull_request:
paths:
- 'packages/**'
+ - '!packages/**/tests/**'
+ - '!packages/**/__tests__/**'
+ - '!packages/**/*.test.*'
- 'benchmarks/**'
+ - '.nvmrc'
workflow_dispatch:
+concurrency:
+ group: benchmarks-${{ github.ref }}
+ cancel-in-progress: false
+ queue: single
+
permissions:
contents: read # required for actions/checkout
id-token: write # required for OIDC authentication with CodSpeed
@@ -72,7 +81,8 @@ jobs:
@benchmarks/${{ matrix.benchmark }}:build:${{ matrix.framework }}
- name: Run ${{ matrix.benchmark }}:${{ matrix.framework }} CodSpeed benchmark
- uses: CodSpeedHQ/action@4296e51e7041e24dadb86d1d6e8b9320d223dbe8 # v5.0.3
+ uses: CodSpeedHQ/action@373d6868929f444bc08d901fd0eb0ad52a8875ea # v5.2.1
+ timeout-minutes: 20
with:
mode: ${{ matrix.mode }}
run: >-
diff --git a/.github/workflows/bundle-size.yml b/.github/workflows/bundle-size.yml
index 23c354e06e..51ffa28e4c 100644
--- a/.github/workflows/bundle-size.yml
+++ b/.github/workflows/bundle-size.yml
@@ -9,12 +9,18 @@ on:
- 'packages/**'
- 'benchmarks/**'
- 'scripts/benchmarks/bundle-size/**'
+ - '.nvmrc'
+ - 'package.json'
+ - 'pnpm-lock.yaml'
push:
branches: [main]
paths:
- 'packages/**'
- 'benchmarks/**'
- 'scripts/benchmarks/bundle-size/**'
+ - '.nvmrc'
+ - 'package.json'
+ - 'pnpm-lock.yaml'
workflow_dispatch:
concurrency:
@@ -45,7 +51,7 @@ jobs:
uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
- name: Measure Bundle Size
- run: pnpm nx run @benchmarks/bundle-size:build --outputStyle=stream --skipRemoteCache
+ run: pnpm benchmark:bundle-size --outputStyle=stream --skipRemoteCache
- name: Capture Benchmark Outputs
id: capture
@@ -103,6 +109,8 @@ jobs:
cat benchmarks/bundle-size/results/pr-comment.md
- name: Upsert Sticky PR Comment
+ # Fork PRs have a read-only GITHUB_TOKEN, so they cannot update comments.
+ if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
@@ -112,7 +120,7 @@ jobs:
benchmark-main:
name: Publish Bundle Size History
- if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'TanStack'
+ if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main' && github.repository_owner == 'TanStack'
runs-on: ubuntu-latest
permissions:
contents: write
@@ -127,7 +135,7 @@ jobs:
uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
- name: Measure Bundle Size
- run: pnpm nx run @benchmarks/bundle-size:build --outputStyle=stream --skipRemoteCache
+ run: pnpm benchmark:bundle-size --outputStyle=stream --skipRemoteCache
- name: Publish Benchmark Dashboard
uses: benchmark-action/github-action-benchmark@52576c92bccf6ac60c8223ec7eb2565637cae9ba # v1.22.1
with:
diff --git a/.github/workflows/compiler-platforms.yml b/.github/workflows/compiler-platforms.yml
new file mode 100644
index 0000000000..ad70e39bb6
--- /dev/null
+++ b/.github/workflows/compiler-platforms.yml
@@ -0,0 +1,101 @@
+name: Compiler Platforms
+
+# The main PR workflow only runs on Linux x64 (glibc). The compilers load a
+# native Yuku binary per platform and handle platform-specific paths, so run
+# their unit tests and a Vite and Rsbuild production build on the other
+# platforms we ship to.
+
+on:
+ pull_request:
+ paths:
+ - 'packages/router-utils/**'
+ - 'packages/router-generator/**'
+ - 'packages/router-plugin/**'
+ - 'packages/start-plugin-core/**'
+ - 'pnpm-lock.yaml'
+ - '.github/workflows/compiler-platforms.yml'
+ schedule:
+ # Weekly, to catch new Yuku releases and runner image updates
+ - cron: '0 6 * * 1'
+ workflow_dispatch:
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+
+env:
+ NX_DAEMON: 'false'
+ NX_NO_CLOUD: 'true'
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ compiler:
+ name: ${{ matrix.name }}
+ runs-on: ${{ matrix.os }}
+ # actions/setup-node only ships glibc builds, so musl uses Alpine's Node image
+ container: ${{ matrix.container }}
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - name: Windows x64
+ os: windows-latest
+ - name: macOS arm64
+ os: macos-latest
+ - name: Linux arm64
+ os: ubuntu-24.04-arm
+ - name: Linux x64 musl
+ os: ubuntu-latest
+ container: node:24.8.0-alpine3.22@sha256:3e843c608bb5232f39ecb2b25e41214b958b0795914707374c8acc28487dea17
+ steps:
+ - name: Install system packages
+ if: ${{ matrix.container }}
+ shell: sh
+ run: apk add --no-cache bash git
+ - name: Keep LF line endings
+ # Snapshots are stored with LF. Windows runners check out CRLF by default,
+ # and with `* text=auto` disabling autocrlf alone still uses the native eol
+ run: |
+ git config --global core.autocrlf false
+ git config --global core.eol lf
+ - name: Checkout
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: false
+ - name: Setup pnpm
+ if: ${{ !matrix.container }}
+ uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
+ - name: Setup Node
+ if: ${{ !matrix.container }}
+ uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
+ with:
+ node-version-file: .nvmrc
+ package-manager-cache: false
+ - name: Setup pnpm (container)
+ if: ${{ matrix.container }}
+ run: npm install --global "$(node -p "require('./package.json').packageManager")"
+ - name: Install dependencies
+ run: >-
+ pnpm install --frozen-lockfile
+ --filter .
+ --filter "@tanstack/router-utils..."
+ --filter "@tanstack/router-generator..."
+ --filter "@tanstack/router-plugin..."
+ --filter "@tanstack/start-plugin-core..."
+ --filter "tanstack-react-start-e2e-basic..."
+ - name: Unit tests
+ run: >-
+ pnpm nx run-many --targets=test:unit
+ --projects=@tanstack/router-utils,@tanstack/router-generator,@tanstack/router-plugin,@tanstack/start-plugin-core
+ --skip-nx-cache --outputStyle=static
+ - name: Production builds
+ run: >-
+ pnpm nx run-many --targets=build:vite:ssr,build:rsbuild:ssr
+ --projects=tanstack-react-start-e2e-basic
+ --skip-nx-cache --outputStyle=static
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
index d8c779b170..fde1100409 100644
--- a/.github/workflows/labeler.yml
+++ b/.github/workflows/labeler.yml
@@ -9,6 +9,8 @@ permissions:
jobs:
labeler:
+ # Fork PRs have a read-only GITHUB_TOKEN, so they cannot update labels.
+ if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- name: Labeller
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 71026a0a92..ae19b4f0d2 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -10,6 +10,13 @@ concurrency:
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
SERVER_PRESET: 'node-server'
+ # Enable dynamic task packing for distributed CI.
+ NX_CLOUD_AGENT_TASK_QUEUE: true
+ NX_CLOUD_AUTO_TASK_PACKING: true
+ NX_CLOUD_AGENT_UNCAPPED_GROUP_WORK: true
+ NX_CLOUD_PACKING_MEM_MULTIPLIER: 1.5
+ NX_CLOUD_BUFFER_TASK_COMPLETIONS: true
+ NX_CLOUD_CONTINUOUS_ASSIGNMENT: true
permissions:
contents: read
@@ -26,8 +33,8 @@ jobs:
with:
fetch-depth: 0
persist-credentials: false
- - name: Start Nx Agents
- run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml"
+ - name: Start Nx Workers
+ run: npx nx-cloud start-workers
- name: Setup Tools
uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
- name: Get base and head commits for `nx affected`
@@ -36,9 +43,9 @@ jobs:
main-branch-name: main
- name: Run Checks
run: pnpm run test:pr --parallel=3
- - name: Stop Nx Agents
+ - name: Stop Nx Workers
if: ${{ always() }}
- run: npx nx-cloud stop-all-agents
+ run: npx nx-cloud stop-all-workers
preview:
name: Preview
runs-on: ubuntu-latest
diff --git a/.gitignore b/.gitignore
index 1699592784..70028b2860 100644
--- a/.gitignore
+++ b/.gitignore
@@ -66,6 +66,7 @@ nx-cloud.env
.nx/workspace-data
.nx/polygraph
.nx/self-healing
+.nx/migrate-runs
gpt/db.json
diff --git a/.nvmrc b/.nvmrc
index b404027604..63f87c20ef 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1 +1 @@
-24.8.0
+26.12.1
diff --git a/.nx/ci-config.yaml b/.nx/ci-config.yaml
new file mode 100644
index 0000000000..2f0783feb4
--- /dev/null
+++ b/.nx/ci-config.yaml
@@ -0,0 +1,5 @@
+dte:
+ distribute-on:
+ small-changeset: 6 linux-medium-js
+ medium-changeset: 12 linux-medium-js
+ large-changeset: 18 linux-medium-js
diff --git a/.nx/workflows/dynamic-changesets.yaml b/.nx/workflows/dynamic-changesets.yaml
deleted file mode 100644
index 39d858d5b2..0000000000
--- a/.nx/workflows/dynamic-changesets.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-distribute-on:
- small-changeset: 4 linux-medium-js
- medium-changeset: 8 linux-medium-js
- large-changeset: 16 linux-medium-js
diff --git a/.nx/workflows/sandboxing-config.yaml b/.nx/workflows/sandboxing-config.yaml
deleted file mode 100644
index 4fa2634bc3..0000000000
--- a/.nx/workflows/sandboxing-config.yaml
+++ /dev/null
@@ -1,9 +0,0 @@
-exclude-reads:
- - e2e/.gitignore
- - '**/src/routeTree.gen.ts'
-exclude-writes:
- - '**/src/routeTree.gen.ts'
-task-exclusions:
- - target: test:build
- exclude-reads:
- - LICENSE
diff --git a/.nx/workflows/ultracache-config.yaml b/.nx/workflows/ultracache-config.yaml
new file mode 100644
index 0000000000..b3ed223621
--- /dev/null
+++ b/.nx/workflows/ultracache-config.yaml
@@ -0,0 +1,124 @@
+ignore-reads:
+ - e2e/.gitignore
+ - '**/src/routeTree.gen.ts'
+ignore-writes:
+ - '**/src/routeTree.gen.ts'
+task-exclusions:
+ - target: test:build
+ ignore-reads:
+ - LICENSE
+ # HMR tests edit these inputs in place and restore their original contents.
+ # Keep them out of cached outputs so cache replay never overwrites source.
+ - project: tanstack-react-start-e2e-deferred-hydration
+ target: test:e2e
+ ignore-writes:
+ - e2e/react-start/deferred-hydration/src/routes/components.tsx
+ - project: tanstack-react-start-e2e-hmr
+ target: test:e2e
+ ignore-writes: &hmr-source-writes
+ - e2e/react-start/hmr/src/components/AliasedRouteImportChildPanel.tsx
+ - e2e/react-start/hmr/src/components/AliasedRouteImportParentPanel.tsx
+ - e2e/react-start/hmr/src/hmr/server-fn-hmr-factory.ts
+ - e2e/react-start/hmr/src/routes/__root.tsx
+ - e2e/react-start/hmr/src/routes/child.tsx
+ - e2e/react-start/hmr/src/routes/component-hmr-inline-error-split.tsx
+ - e2e/react-start/hmr/src/routes/component-hmr-inline-nosplit.tsx
+ - e2e/react-start/hmr/src/routes/component-hmr-inline-split.tsx
+ - e2e/react-start/hmr/src/routes/component-hmr-lowercase-named-split.tsx
+ - e2e/react-start/hmr/src/routes/component-hmr-named-error-split.tsx
+ - e2e/react-start/hmr/src/routes/component-hmr-named-nosplit.tsx
+ - e2e/react-start/hmr/src/routes/component-hmr-named-split.tsx
+ - e2e/react-start/hmr/src/routes/index.tsx
+ - e2e/react-start/hmr/src/routes/inputs.tsx
+ - project: tanstack-react-start-e2e-hmr
+ target: test:e2e--vite-ssr
+ ignore-writes: *hmr-source-writes
+ - project: tanstack-react-start-e2e-hmr
+ target: test:e2e--vite-ssr--bundled-dev
+ ignore-writes: *hmr-source-writes
+ - project: tanstack-react-start-e2e-hmr
+ target: test:e2e--rsbuild-ssr
+ ignore-writes: *hmr-source-writes
+ - project: tanstack-react-start-e2e-rsbuild
+ target: test:e2e--rsbuild-ssr
+ ignore-writes:
+ - e2e/react-start/rsbuild/src/routes/index.tsx
+ - project: tanstack-react-start-e2e-server-functions
+ target: test:e2e
+ ignore-writes:
+ - e2e/react-start/server-functions/src/routes/consistent.tsx
+ # Scaffolding tests deliberately populate tracked empty route fixtures.
+ - project: '@tanstack/router-generator'
+ target: test:unit
+ ignore-writes:
+ - packages/router-generator/tests/generator/custom-scaffolding/routes/__root.tsx
+ - packages/router-generator/tests/generator/custom-scaffolding/routes/api/bar.tsx
+ - packages/router-generator/tests/generator/custom-scaffolding/routes/foo.lazy.tsx
+ - packages/router-generator/tests/generator/custom-scaffolding/routes/index.tsx
+ # These reads are of scratch files created by the same test invocation.
+ - project: tanstack-solid-start-e2e-basic-auth
+ target: test:e2e
+ ignore-reads:
+ - e2e/solid-start/basic-auth/.tmp/dev.db
+ - project: tanstack-vue-start-e2e-basic-auth
+ target: test:e2e
+ ignore-reads:
+ - e2e/vue-start/basic-auth/.tmp/dev.db
+ - project: '@tanstack/router-generator'
+ target: test:unit
+ ignore-reads:
+ - packages/router-generator/tests/generator/file-modification/routes/[(]test[)]/initiallyEmpty.tsx
+ - packages/router-generator/tests/generator/file-modification/routes/[(]test[)]/initiallyEmpty.lazy.tsx
+ # Mutable counters are scratch state, not artifacts to replay from cache.
+ - project: tanstack-react-start-e2e-basic-tsr-config
+ target: test:e2e
+ ignore-reads:
+ - e2e/react-start/basic-tsr-config/count.txt
+ ignore-writes:
+ - e2e/react-start/basic-tsr-config/count.txt
+ - project: tanstack-solid-start-e2e-basic-tsr-config
+ target: test:e2e
+ ignore-reads:
+ - e2e/solid-start/basic-tsr-config/count.txt
+ ignore-writes:
+ - e2e/solid-start/basic-tsr-config/count.txt
+ - project: tanstack-vue-start-e2e-basic-tsr-config
+ target: test:e2e
+ ignore-reads:
+ - e2e/vue-start/basic-tsr-config/count.txt
+ ignore-writes:
+ - e2e/vue-start/basic-tsr-config/count.txt
+ # Paraglide downloads compiler plugins from the URLs in settings.json.
+ # Ignore warm-cache reads; the settings remain inputs and cache files outputs.
+ - project: tanstack-react-start-e2e-i18n-paraglide
+ target: build
+ ignore-reads:
+ - e2e/react-start/i18n-paraglide/project.inlang/cache/plugins/*
+ - project: tanstack-router-e2e-react-i18n-paraglide
+ target: build
+ ignore-reads:
+ - e2e/react-router/i18n-paraglide/project.inlang/cache/plugins/*
+ - project: tanstack-react-start-e2e-i18n-paraglide
+ target: test:e2e
+ ignore-reads:
+ - e2e/react-start/i18n-paraglide/project.inlang/cache/plugins/*
+ - project: tanstack-router-e2e-react-i18n-paraglide
+ target: test:e2e
+ ignore-reads:
+ - e2e/react-router/i18n-paraglide/project.inlang/cache/plugins/*
+ - project: tanstack-router-i18n-paraglide
+ target: build
+ ignore-reads:
+ - examples/react/i18n-paraglide/project.inlang/cache/plugins/*
+ - project: tanstack-start-i18n-paraglide
+ target: build
+ ignore-reads:
+ - examples/react/start-i18n-paraglide/project.inlang/cache/plugins/*
+ - project: tanstack-router-solid-i18n-paraglide
+ target: build
+ ignore-reads:
+ - examples/solid/i18n-paraglide/project.inlang/cache/plugins/*
+ - project: tanstack-solid-start-i18n-paraglide
+ target: build
+ ignore-reads:
+ - examples/solid/start-i18n-paraglide/project.inlang/cache/plugins/*
diff --git a/.nxignore b/.nxignore
deleted file mode 100644
index 867e529a65..0000000000
--- a/.nxignore
+++ /dev/null
@@ -1,23 +0,0 @@
-# Solid v2 migration: temporarily excluded apps.
-#
-# These apps depend on third-party packages that do not yet support SolidJS v2
-# (solid-js@2.x). They cannot build against the v2 catalog and are excluded from
-# the Nx graph (build + e2e) until the upstream deps ship Solid v2 support.
-# Re-include each one by deleting its line once its blocking dep is Solid-2 ready.
-
-# solid-motionone (peer solid-js ^1.8.0, no Solid 2 release)
-examples/solid/with-framer-motion
-
-# convex-solidjs@0.0.3 (peer solid-js ^1.6.0, imports solid-js/web)
-examples/solid/start-convex-better-auth
-
-# @tanstack/solid-virtual (no Solid 2 release; imports solid-js/store)
-examples/solid/scroll-restoration
-e2e/solid-router/basic-scroll-restoration
-
-# @tanstack/solid-devtools@0.7.0 (devtools shell, peer solid-js >=1.9.7)
-examples/solid/start-bun
-examples/solid/start-i18n-paraglide
-
-# @sentry/solid@10.x (imports splitProps from solid-js)
-e2e/solid-router/sentry-integration
diff --git a/.prettierignore b/.prettierignore
index 65991e1964..de501452ad 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -17,4 +17,7 @@ node_modules
/.nx/workspace-data
**/src/routeTree.gen.ts
packages/router-plugin/tests/**/test-files/**
-.nx/self-healing
\ No newline at end of file
+.nx/self-healing
+
+# Preserve the pinned upstream URL fixtures byte for byte.
+packages/router-core/tests/fixtures/wpt-url/urltestdata*.json
diff --git a/AGENTS.md b/AGENTS.md
index 490cb691d4..f47b5103e1 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,177 +1,41 @@
# AGENTS.md
-## Project overview
+## Scope
-TanStack Router is a type-safe router with built-in caching and URL state management for React and Solid applications. This monorepo contains two main products:
+- Read applicable nested `AGENTS.md` files before editing or testing a subtree.
+- Shared routing belongs in `packages/router-core`; check React, Solid, and Vue bindings for shared changes. Shared Start runtime/build logic lives in `packages/start-*-core`.
-- **TanStack Router** - Core routing library with type-safe navigation, search params, and path params
-- **TanStack Start** - Full-stack framework built on top of TanStack Router
+## Work and validation
-## Setup commands
+- Start bug fixes with a failing regression test that uses only public APIs to reproduce and assert user- or developer-visible behavior. Do not manufacture bugs by mutating internals. Establish whether real usage can reach the failing state before adding runtime handling; simplify handling of states proven unreachable.
+- When removing an API, option, or behavior, delete its tests. Never add tests that assert the removed thing is gone, such as `not.toHaveProperty('oldName')`, a type error for the old call, or a runtime throw.
+- For suspected dependency issues, verify the upstream root cause, then propose an upstream fix to the user, including for other `@tanstack/*` packages. **Never implement a workaround in this repository unless the user explicitly authorizes it.**
+- During debugging/prototyping, keep fixes aligned with the PR's intended architecture. If making a test pass requires another flag, counter, copied deadline, or duplicate completion authority, stop and consolidate state and ownership. Remove superseded paths instead of accumulating patches and bundle growth.
+- Use Node from `.nvmrc` and pnpm from root `package.json`. Install at the root with `CI=1 pnpm install --frozen-lockfile`.
+- For sandbox-blocked registry/store access, escalate the same command; report the blocker if unavailable. Do not change stores, delete dependencies/lockfiles, use `--force`/`--ignore-scripts`, or weaken workspace trust/build policies to bypass it.
+- Never manually edit `pnpm-lock.yaml` or any `routeTree.gen.ts`. Regenerate the lockfile with `pnpm install --no-frozen-lockfile` after intentional dependency changes; regenerate route trees through app builds/dev servers or the generator fixture harness.
+- Always use control-flow braces. Run `pnpm format` before validation.
+- Use Nx: workspace imports consume built packages, so direct runners can test stale dependencies. Inspect resolved targets with `pnpm nx show project --json`; some are inferred.
+- Run finite validation through `run-many` with explicit projects and targets, including a single project/target. Nx automatically selects `summary` output when it detects an AI agent: omit `--outputStyle` for normal runs. Read the reported full log files for failures; use `--outputStyle=summary` if agent detection is unavailable.
+- Use `--outputStyle=static` or `pnpm nx run :` only when diagnosing a task and its full output is needed. Continuous/watch targets may use live output.
-- Install deps: `pnpm install`
-- Setup e2e testing: `pnpm exec playwright install`
-- Build packages: `pnpm build` (affected) or `pnpm build:all` (force all)
-- Start dev server: `pnpm dev`
-- Run tests: `pnpm test`
+```sh
+CI=1 NX_DAEMON=false pnpm nx run-many -p -t --skipRemoteCache
+```
-## Code style
+- Run one Nx command at a time. For a ~20-second startup/graph stall, stop, run `pnpm nx reset`, and retry once, then escalate. Do not apply that timeout to running tests.
+- For code changes, run affected packages' `test:unit`, `test:types`, and `test:eslint` where available, including affected consumers; use `test:e2e` for browser/app behavior and `test:build` for exports/build changes. Root `pnpm test` includes the full e2e suite. Published-code changes require `pnpm changeset`.
-- TypeScript strict mode with extensive type safety
-- Framework-agnostic core logic separated from React/Solid bindings
-- Type-safe routing with search params and path params
-- Use workspace protocol for internal dependencies (`workspace:*`)
-- Always use curly braces for `if`, `else`, loops, and similar control statements. Never write one-line bodies like `if (foo) x = 1`.
+## Runtime rules
-## Dev environment tips
+- Import `isServer` from `@tanstack/router-core/isServer`. Conditional exports select: `development` → `undefined`; server (`workerd`, `worker`, `deno`, `node`, `bun`) → `true` except `NODE_ENV=test` → `undefined`; browser/fallback → `false`. `development` wins; `NODE_ENV=development` alone does not select it.
+- Keep `isServer ?? router.isServer` directly in each branch condition for dead-code elimination; negate the whole expression for client branches. Never extract it into a variable (e.g. `const serverRendering = isServer ?? router.isServer`) or helper. Without a router, inline `isServer ?? typeof window === 'undefined'` (or the existing `document` check). Keep the constant first and use `??`, never `||`.
+- **Never create UI/router reactivity on the server, including development/tests.** Branch before reactive setup; use direct reads and core non-reactive stores. Required transport listeners are allowed only with request-scoped lifetimes and cleanup.
+- Shared route definitions/build metadata must not acquire request/user data. Keep it on the request's Router, context, or QueryClient.
+- HMR can replace code while caches and pending work survive. Invalidate derived state or bypass caching in development; reject stale async results while preserving intentional HMR identities/state.
+- Gate developer diagnostics and message construction with direct `process.env.NODE_ENV !== 'production'` checks. Preserve required validation/throws in production (e.g. detailed development error, compact `invariant()` failure). `!== 'development'` also enables the guarded code in tests; preserve existing dev-server mode gates.
-- This is a pnpm workspace monorepo with packages organized by functionality
-- Nx provides caching, affected testing, targeting, and parallel execution for efficiency
-- Use `pnpm nx show projects` to list all available packages
-- Target specific packages: `pnpm nx run @tanstack/react-router:test:unit`
-- Target multiple packages: `pnpm nx run-many --target=test:eslint --projects=@tanstack/history,@tanstack/router-core`
-- Run affected tests only: `pnpm nx affected --target=test:unit`
-- Exclude patterns: `pnpm nx run-many --target=test:unit --exclude="examples/**,e2e/**"`
-- Navigate to examples and run `pnpm dev` to test changes: `cd examples/react/basic && pnpm dev`
-- **Granular unit testing through Nx (recommended):**
- - Specific files: `pnpm nx run @tanstack/react-router:test:unit -- tests/link.test.tsx tests/Scripts.test.tsx`
- - Test patterns: `pnpm nx run @tanstack/react-router:test:unit -- tests/ClientOnly.test.tsx -t "should render fallback"`
- - Name patterns: `pnpm nx run @tanstack/react-router:test:unit -- -t "navigation"` (all tests with "navigation" in name)
- - Exclude patterns: `pnpm nx run @tanstack/react-router:test:unit -- --exclude="**/*link*" tests/`
- - List tests: `pnpm nx run @tanstack/react-router:test:unit -- list tests/link.test.tsx` (or `-- list` for all)
-- **Available test targets per package:** `test:unit`, `test:types`, `test:eslint`, `test:build`, `test:perf`, `build`
-- **Testing strategy:** Package level (nx) → File-level args via nx → Test-level args (`-t`) via nx → Pattern-level args (`--exclude`) via nx
-- **Agent execution guardrails (important):**
- - Always prefer `pnpm nx ...` over `npx nx ...`.
- - Prefer Nx targets over direct test runners so task dependencies (including required builds) remain in the graph.
- - In sandbox, run Nx with `CI=1 NX_DAEMON=false pnpm nx run : --outputStyle=stream --skipRemoteCache`
- - Run only one Nx command at a time.
- - If an Nx command shows no output for ~20 seconds, stop, run `pnpm nx reset` once, and retry once.
- - Do not loop retries indefinitely. If it still hangs or sandbox blocks graph/daemon behavior, request escalation immediately.
+## Performance and final bundle pass
-## Testing instructions
-
-- **Critical**: Always run unit and type tests during development - do not proceed if they fail
-- **Test types:** `pnpm test:unit`, `pnpm test:types`, `pnpm test:eslint`, `pnpm test:e2e`, `pnpm test:build`
-- **Full CI suite:** `pnpm test:ci`
-- **Fix formatting:** `pnpm format`
-- **Efficient targeted testing workflow:**
- 1. **Affected only:** `pnpm nx affected --target=test:unit` (compares to main branch)
- 2. **Specific packages:** `pnpm nx run @tanstack/react-router:test:unit`
- 3. **Specific files:** `pnpm nx run @tanstack/react-router:test:unit -- tests/link.test.tsx`
- 4. **Specific patterns:** `pnpm nx run @tanstack/react-router:test:unit -- tests/link.test.tsx -t "preloading"`
-- **Pro tips:**
- - Use `pnpm nx run @tanstack/react-router:test:unit -- list` to explore available tests before running
- - Use `-t "pattern"` to focus on specific functionality during development
- - Use `--exclude` patterns to skip unrelated tests
- - Keep all test filtering arguments behind `pnpm nx run ... -- ...` for maximum precision while preserving task dependencies
-- **Example workflow:** `pnpm nx run @tanstack/react-router:test:unit` → `pnpm nx run @tanstack/react-router:test:unit -- tests/link.test.tsx` → `pnpm nx run @tanstack/react-router:test:unit -- tests/link.test.tsx -t "preloading"`
-
-## PR instructions
-
-- Always run `pnpm test:eslint`, `pnpm test:types`, and `pnpm test:unit` before committing
-- Test changes in relevant example apps: `cd examples/react/basic && pnpm dev`
-- Update corresponding documentation in `docs/` directory when adding features
-- Add or update tests for any code changes
-- Use internal docs links relative to `docs/` folder (e.g., `./guide/data-loading`)
-
-## Package structure
-
-**Core packages:**
-
-- `packages/router-core/` - Framework-agnostic core router logic
-- `packages/react-router/`, `packages/solid-router/` - React/Solid bindings and components
-- `packages/history/` - Browser history management
-
-**Tooling:**
-
-- `packages/router-cli/` - CLI tools for code generation
-- `packages/router-generator/` - Route generation utilities
-- `packages/router-plugin/` - Universal bundler plugins (Vite, Webpack, ESBuild, Rspack)
-- `packages/virtual-file-routes/` - Virtual file routing system
-
-**Developer experience:**
-
-- `packages/router-devtools/`, `packages/*-router-devtools/` - Development tools
-- `packages/eslint-plugin-router/` - ESLint rules for router
-
-**Validation adapters:**
-
-- `packages/zod-adapter/`, `packages/valibot-adapter/`, `packages/arktype-adapter/`
-
-**Start framework:**
-
-- `packages/*-start/`, `packages/start-*/` - Full-stack framework packages
-
-**Examples & testing:**
-
-- `examples/react/`, `examples/solid/` - Example applications (test changes here)
-- `e2e/` - End-to-end tests (requires Playwright)
-- `docs/router/`, `docs/start/` - Documentation with React/Solid subdirectories
-
-**Dependencies:** Uses workspace protocol (`workspace:*`) - core → framework → start packages
-
-## Common development tasks
-
-**Adding new routes:**
-
-- Use file-based routing in `src/routes/` directories
-- Or use code-based routing with route definitions
-- Run route generation with CLI tools
-
-**Testing changes:**
-
-- Build packages: `pnpm build` or `pnpm dev` (watch mode)
-- Run example apps to test functionality
-- Use devtools for debugging router state
-
-**Documentation updates:**
-
-- Update relevant docs in `docs/` directory
-- Ensure examples reflect documentation changes
-- Test documentation links and references
-- Use relative links to `docs/` folder format
-
-## Framework-specific notes
-
-**React:**
-
-- Uses React Router components and hooks
-- Supports React Server Components (RSC)
-- Examples include React Query integration
-- Package: `@tanstack/react-router`
-
-**Solid:**
-
-- Uses Solid Router components and primitives
-- Supports Solid Start for full-stack applications
-- Examples include Solid Query integration
-- Package: `@tanstack/solid-router`
-
-## Environment requirements
-
-- **Node.js** - Required for development
-- **pnpm** - Package manager (required for workspace features)
-- **Playwright** - Required for e2e tests (`pnpm exec playwright install`)
-
-## Key architecture patterns
-
-- **Type Safety**: Extensive TypeScript for type-safe routing
-- **Framework Agnostic**: Core logic separated from framework bindings
-- **Plugin Architecture**: Universal bundler plugins using unplugin
-- **File-based Routing**: Support for both code-based and file-based routing
-- **Search Params**: First-class support for type-safe search parameters
-
-## Development workflow
-
-1. **Setup**: `pnpm install` and `pnpm exec playwright install`
-2. **Build**: `pnpm build:all` or `pnpm dev` for watch mode
-3. **Test**: Make changes and run relevant tests (use nx for targeted testing)
-4. **Examples**: Navigate to examples and run `pnpm dev` to test changes
-5. **Quality**: Run `pnpm test:eslint`, `pnpm test:types`, `pnpm test:unit` before committing
-
-## References
-
-- **Documentation**: https://tanstack.com/router
-- **GitHub**: https://github.com/TanStack/router
-- **Discord Community**: https://discord.com/invite/WrRKjPJ
+- For runtime/memory changes, compare identical baseline/candidate workloads using the relevant [benchmark guide](benchmarks/AGENTS.md): client navigation, Start SSR, or memory. Add coverage for unmeasured mechanisms.
+- **Last phase for every change affecting emitted client JavaScript**, including core/build transforms: complete the full [bundle-size-optimization skill](.agents/skills/bundle-size-optimization/SKILL.md) after correctness and performance validation. The full workflow is mandatory.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e9e793926f..4b6e808af1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -33,7 +33,17 @@ TanStack Router is a community project. Contributions to both TanStack Router an
## Before you start
-PRs that require API changes must first be proposed as an issue and receive maintainer sign-off before implementation begins.
+- Search the [open and closed issues](https://github.com/TanStack/router/issues?q=is%3Aissue) before reporting a bug. If it has not already been reported, use the [bug report template](https://github.com/TanStack/router/issues/new?template=bug_report.yml).
+- Search the [open and closed pull requests](https://github.com/TanStack/router/pulls?q=is%3Apr) before starting work to avoid duplicating an existing contribution.
+- Pull requests that require API changes must first be proposed as an issue and receive maintainer sign-off before implementation begins.
+
+## Pull request guidelines
+
+Every pull request must follow the [TanStack Router pull request template](.github/pull_request_template.md). Complete its description and checklist without removing or bypassing the required sections.
+
+- Keep each pull request focused on one change or topic. Pull requests that combine unrelated changes will be closed with a request to split them into separately reviewable contributions.
+- Write a concise description that clearly explains what changed and why. Follow the sections in the pull request template; a long, unstructured description makes a contribution harder to review.
+- Every change that affects a published package must include a changeset. Create it with `pnpm changeset`; documentation, CI, examples, and development-only changes do not require one.
## Development
@@ -132,10 +142,19 @@ pnpm dev
## AI-assisted contributions
+
+
AI tools can be useful for exploring the codebase, drafting changes, and writing tests. They do not replace the contributor's responsibility for the result.
1. **Keep the contribution in your own voice**. Review and rewrite generated code comments, issue reports, and pull request descriptions so they reflect what you actually mean.
2. **Keep ownership of technical decisions**. Understand every change, verify its behavior with the appropriate tests and documentation, and be ready to explain it during review.
3. **Do not paste LLM output verbatim into the codebase or a contribution**. Treat generated text and code as a draft: check its claims, adapt it to the repository, and remove anything you cannot justify. Issues or pull requests that appear to contain unreviewed LLM output may be closed without further review.
+4. **Do not mass-submit unrelated or low-quality AI-generated pull requests**. We treat that behavior as spam and may close the pull requests, block the contributor, and report the GitHub account.
AI-assisted contributions follow the same standards for correctness, testing, documentation, and review as every other contribution.
diff --git a/RFC-solid-native-ssr.md b/RFC-solid-native-ssr.md
deleted file mode 100644
index bdc1030fa6..0000000000
--- a/RFC-solid-native-ssr.md
+++ /dev/null
@@ -1,138 +0,0 @@
-# RFC: Solid-native SSR/hydration for `@tanstack/solid-router`
-
-**Status:** draft for discussion
-**Scope:** the Solid adapter's SSR transfer and hydration boot — not the cross-framework router API
-
-## Context
-
-The Solid v2 line has been converging on a pattern, one PR at a time: every
-mechanism the router carried for moving state across the wire has a Solid
-2.0 channel that does it natively, and every replacement so far has shrunk
-code and payload while keeping every e2e suite green.
-
-- SSR query transfer → the hydration registry, content-addressed
- (`solid-query` v6; `solid-router-ssr-query` retired in
- [#8193](https://github.com/TanStack/router/pull/8193), which removed a
- double-ship of every query payload)
-- Post-mutation data → the multi-source single-flight envelope
- ([#8192](https://github.com/TanStack/router/pull/8192): named sources +
- `loadFlightTarget`)
-- Redirects from cache-driven fetches → a dozen lines composing
- `isRedirect`/`resolveRedirect` with the caches' `config.onError`
-- The reference for all of it: solidjs/templates `fullstack-tanstack`
- (bare vite + Router + Query, no Start, no integration package —
- [templates#287](https://github.com/solidjs/templates/pull/287))
-
-What remains are the deeper assumptions, inherited from the React
-integration model where the framework has no serialization channel and no
-hydration-claiming, so the router had to build both:
-
-1. **The router owns the SSR envelope.** `router.serverSsr`, the
- `dehydrate()`/`hydrate()` options, and the `__TSR_SSR__` script protocol
- form a parallel serialization channel through the router's own stream
- injection.
-2. **The router loads before hydration.** The client is expected to
- resolve and commit matches before first render (the template's
- `bootLoad`, plus the prefetch-pausing it drags along) because React
- hydration can't claim through async work.
-3. **The router owns the HTML's boundary structure.** A global catch
- boundary is injected client-side that the server never rendered —
- correct when TanStack's stream handlers produce the HTML, a hydration
- mismatch when Solid's renderer does (today's escape hatch:
- `disableGlobalCatchBoundary: true`).
-4. **Suspense-era data ergonomics.** Deferred/`Await` patterns exist
- because components couldn't just read async values. In Solid 2 they
- can; the idiomatic usage is already "loaders as non-blocking prefetch
- hints, suspension at the read point."
-
-## Principles
-
-- **The framework channel is the transfer.** Anything Solid can serialize
- through the hydration registry (promise-valued, streamed by seroval as
- it settles) should not ride a router-owned side channel.
-- **Never block up front.** No pre-hydration load pass, no up-front chunk
- resolution, no envelope waiting. Solid's `lazy` already participates in
- hydration — a route chunk resolves under its boundary and claims its
- markup when it lands — so `route.lazy` maps onto read-point resolution.
- The same goes for data: pending loaders transfer as promises and settle
- where they're read.
-- **Loader API semantics are untouched.** Blocking loaders,
- `pendingComponent`, `beforeLoad`, deferred — the cross-framework
- contract stays. This RFC changes how the _adapter_ transfers and boots,
- not what the API promises.
-- **Data lives in caches that know how to transfer themselves.** The
- router transfers _its_ state (matches, `loaderData`, statuses); query
- caches transfer theirs; the flight envelope keys them independently.
- Nothing aggregates someone else's state.
-
-## Phase 1 — the bare pairing goes fully native (no Start exposure)
-
-The template path (`createRouter` + `RouterProvider` under Solid's
-renderer) never enters `createStartHandler`, so it can change freely.
-
-- **Registry match transfer.** _(Landed: `registryTransfer.ts`,
- serialization in `RouterProvider`.)_ During server render the adapter
- serializes each settled match's state content-addressed
- (`tsr:` keys) — the pattern `solid-query`'s provider proved.
- Still open within this bullet: promise-valued entries for matches
- pending at render time (streaming SSR). This core has no per-match
- settle promise, so it needs a dispatch-time hook; today pending matches
- are skipped and the client boot falls through to current behavior.
-- **Hydration-claiming boot.** _(Landed: the `Router` constructor.)_
- Match synchronously, prime match state from the registry, commit
- without running loaders. Placement discovered to be load-bearing:
- committing inside the hydration render desyncs the claiming walk's
- registry bookkeeping even with writes moved off the owner — router
- creation is the client's natural pre-render moment (after document
- parse, before `hydrate()`). Route chunks resolve at the read point via
- Solid `lazy` semantics. This deleted the template's `bootLoad` (and its
- URL-divergence reload guard) and the prefetch-pausing flag outright —
- verified on the production template: zero server-function requests at
- boot, hydration clean, single-flight unchanged.
-- **Boundary parity.** _(Already true on this line.)_ The adapter's
- boundary structure is symmetric between server and client
- (`_resolveMatchesLoadingBoundary` consults no hydration state), so
- `disableGlobalCatchBoundary` is no longer a parity workaround — it
- survives as a semantic choice: let errors (including SSR-thrown
- `redirect()`) bubble past the router to app-owned boundaries and the
- stream handler. The template's comment was corrected to say so.
-
-## Phase 2 — Start rides it behind the existing contract
-
-`start-server-core` orchestrates through `attachRouterServerSsrUtils`,
-`dehydrate()`/`hydrate()`, and the stream handler — that contract is
-shared core and stays intact as a facade. Within it, the Solid
-`defaultStreamHandler`/`renderRouterToStream` source the transfer from the
-registry channel instead of `__TSR_SSR__` script injection wherever both
-exist; user `dehydrate`/`hydrate` hooks keep working. The flight collector
-already went through this door: `loadFlightTarget` absorbed the
-event-derivation half, and its extraction half shrinks further once match
-state is registry-addressed.
-
-**Regression gate:** the three Solid Start e2e suites
-(`basic-solid-query`, `server-functions`, `server-routes` — 37 tests,
-including redirect-from-query on both mount and SSR paths, and the
-transition semantics) all run locally today and define "didn't break
-Start."
-
-## Phase 3 — upstream
-
-Once both runs are proven, propose the defaults upstream with working
-code and measured deltas (payload double-ship eliminated, boot code
-deleted, boundary workaround gone), the same argument shape as #8193 one
-layer deeper. React/Vue adapters are untouched throughout;
-`router-ssr-query-core`'s transport remains correct for frameworks
-without a native channel.
-
-## Open questions
-
-- Match key identity: route id + params hash vs match id — needs to be
- stable across server/client and across redirects into the same route.
-- `loaderData` streaming semantics vs the existing deferred API: a
- promise-valued registry entry makes deferred _transfer_ free, but the
- read-side API compatibility needs mapping.
-- Scroll restoration and `__TSR_SSR__` consumers beyond match state
- (manifest/asset injection) — inventory what else rides the script
- channel before swapping it.
-- Where the SSR teardown lands for router state (the query cache got
- cancel+clear on render disposal; matches may want the same).
diff --git a/_artifacts/domain_map.yaml b/_artifacts/domain_map.yaml
index 4b5d6f8386..0b2672f0c6 100644
--- a/_artifacts/domain_map.yaml
+++ b/_artifacts/domain_map.yaml
@@ -147,13 +147,15 @@ skills:
context types to not flow into loader.
wrong_pattern: |
createFileRoute('/posts')({
- loader: ({ context }) => context.queryClient.ensureQueryData(postsQuery),
+ loader: ({ context }) =>
+ context.queryClient.query({ ...postsQuery, staleTime: 'static' }),
beforeLoad: ({ context }) => ({ queryClient: context.queryClient }),
})
correct_pattern: |
createFileRoute('/posts')({
beforeLoad: ({ context }) => ({ queryClient: context.queryClient }),
- loader: ({ context }) => context.queryClient.ensureQueryData(postsQuery),
+ loader: ({ context }) =>
+ context.queryClient.query({ ...postsQuery, staleTime: 'static' }),
})
source: 'docs/router/eslint/create-route-property-order.md'
priority: HIGH
@@ -536,7 +538,7 @@ skills:
- '@tanstack/react-router-ssr-query'
covers:
- External cache coordination pattern
- - queryClient.ensureQueryData in loader
+ - "queryClient.query with staleTime: 'static' in loader"
- useSuspenseQuery in components
- setupRouterSsrQueryIntegration
- defaultPreloadStaleTime
@@ -579,11 +581,11 @@ skills:
priority: HIGH
status: active
- - mistake: 'Awaiting prefetchQuery in loader blocks rendering'
+ - mistake: 'Awaiting a fire-and-forget query in loader blocks rendering'
mechanism: >-
- For streaming/deferred patterns, prefetchQuery should NOT
- be awaited in the loader — it starts fetching on server
- and streams without blocking. Awaiting defeats the purpose.
+ For streaming/deferred patterns, start a query without awaiting
+ it and handle failures with catch(noop) — it starts fetching on
+ the server and streams without blocking. Awaiting defeats the purpose.
source: 'docs/router/integrations/query.md'
priority: MEDIUM
status: active
diff --git a/_artifacts/skill_spec.md b/_artifacts/skill_spec.md
index 4503afb48a..7eb9554a42 100644
--- a/_artifacts/skill_spec.md
+++ b/_artifacts/skill_spec.md
@@ -83,11 +83,11 @@ TanStack Router is a type-safe router for React and Solid applications with buil
### external-data-loading (3 failure modes)
-| # | Mistake | Priority | Source | Cross-skill? |
-| --- | ------------------------------------------------- | -------- | -------------------------------- | ------------ |
-| 1 | Not setting defaultPreloadStaleTime to 0 | HIGH | docs/guide/external-data-loading | — |
-| 2 | Creating QueryClient outside createRouter for SSR | HIGH | docs/guide/external-data-loading | — |
-| 3 | Awaiting prefetchQuery in loader blocks rendering | MEDIUM | docs/integrations/query | — |
+| # | Mistake | Priority | Source | Cross-skill? |
+| --- | ----------------------------------------------------------- | -------- | -------------------------------- | ------------ |
+| 1 | Not setting defaultPreloadStaleTime to 0 | HIGH | docs/guide/external-data-loading | — |
+| 2 | Creating QueryClient outside createRouter for SSR | HIGH | docs/guide/external-data-loading | — |
+| 3 | Awaiting a fire-and-forget query in loader blocks rendering | MEDIUM | docs/integrations/query | — |
### auth-and-guards (3 failure modes)
diff --git a/_artifacts/skill_tree.yaml b/_artifacts/skill_tree.yaml
index ec38a04bdd..6f7c4c8742 100644
--- a/_artifacts/skill_tree.yaml
+++ b/_artifacts/skill_tree.yaml
@@ -246,7 +246,7 @@ skills:
package: 'packages/react-router'
description: >-
Integrating TanStack Router with TanStack Query: queryClient
- in router context, ensureQueryData/prefetchQuery in loaders,
+ in router context, static queries and fire-and-forget queries in loaders,
useSuspenseQuery in components, defaultPreloadStaleTime: 0,
setupRouterSsrQueryIntegration for SSR dehydration/hydration
and streaming, per-request QueryClient isolation.
diff --git a/benchmarks/AGENTS.md b/benchmarks/AGENTS.md
new file mode 100644
index 0000000000..9d56a2411a
--- /dev/null
+++ b/benchmarks/AGENTS.md
@@ -0,0 +1,15 @@
+# Benchmarks
+
+Read the relevant README before running benchmarks. Compare baseline and candidate with the same workload and production builds; add a focused case when existing scenarios miss the changed mechanism. Keep workloads and benchmark names stable for historical comparisons.
+
+| Changed behavior | Guide | Nx project |
+| ------------------------------------------ | ---------------------------------- | -------------------------------------------------------- |
+| Standalone Router navigation/rendering CPU | [client-nav](client-nav/README.md) | `@benchmarks/client-nav` |
+| Start request/SSR CPU | [ssr](ssr/README.md) | `@benchmarks/ssr` |
+| Client/server retention and allocations | [memory](memory/README.md) | `@benchmarks/memory-client`, `@benchmarks/memory-server` |
+
+Use `test:perf:` through Nx. Plain memory runs only smoke-test; memory metrics require CodSpeed. Client navigation benchmarks do not cover Start hydration or client server-function calls.
+
+Run `vitest bench` directly only with `--mode benchmark`, as the Nx targets do. Vitest 5 otherwise uses Vite's `test` mode, where vite-plugin-solid injects a jest-dom setup file that benchmark packages cannot resolve.
+
+For bundle-size work, follow the full optimization skill required by the root guide. Full API fixtures are maintained manually: when public hooks/components change, update matching `bundle-size/scenarios/*-full/src/routes/__root.tsx` fixtures. Save baseline results separately because each run overwrites `bundle-size/results/current.json`; report final gzip deltas and explain remaining growth.
diff --git a/benchmarks/README.md b/benchmarks/README.md
new file mode 100644
index 0000000000..94d2f31802
--- /dev/null
+++ b/benchmarks/README.md
@@ -0,0 +1,88 @@
+# CPU simulation benchmarks
+
+`client-nav` measures navigation, mounting, and React/Solid hydration in
+Node/jsdom; `ssr` measures server requests.
+Both suites run through the CodSpeed Vitest integration in CPU simulation mode.
+
+## Worker runtime
+
+Every CPU benchmark project includes `cpuSimulationExecArgv()` from
+[`cpu-simulation.ts`](./cpu-simulation.ts). It augments CodSpeed's worker flags
+only during CPU simulation, including the legacy `instrumentation` mode.
+
+The pinned CodSpeed integration supplies `--no-opt`. In Node 24 this is an alias
+for `--no-turbofan`, so Maglev can still optimize and inline hot functions. The
+additional `--no-maglev` keeps the optimizing compiler out of the simulation.
+`--always-sparkplug` compiles baseline code on first use, so warmup does not leave
+functions approaching a later tier-up or batch-compilation threshold. The worker
+regression test checks that even a once-called function receives baseline code.
+The integration also omits the old `--no-scavenge-task` flag on Node 20 and
+newer, where V8 renamed it to `--no-minor-gc-task`. Supplying the renamed flag
+keeps minor GC tied to allocation pressure instead of scheduled foreground
+tasks. Both flags follow the fixes in
+[CodSpeed's Node 24 support](https://github.com/CodSpeedHQ/codspeed-node/commit/e3224e7872).
+
+`--initial-old-space-size=512` fixes the initial/minimum old-generation
+allocation budget at 512 MiB. Removing only this override after worker isolation
+left two Vue SSR scenarios with same-commit spreads above 2% in five full-suite
+repetitions. The paired default-heap comparison with stock incremental-marking
+tasks also exceeded 2%. Runtime comparisons and tested alternatives are recorded in
+[PR #8248](https://github.com/TanStack/router/pull/8248).
+
+This is a GC-policy tradeoff. Minor collections and allocation work remain
+measured, and CodSpeed still explicitly collects before measurement. However,
+V8 can skip automatic full collections below this old-generation budget, so the
+benchmark can omit some eventual full-GC CPU cost from increased object
+retention. Repeatability does not establish representative production GC
+frequency. The flag does not preallocate 512 MiB; the existing 4096 MiB maximum
+remains. See [V8's initial/minimum heap configuration](https://github.com/nodejs/node/blob/v24.8.0/deps/v8/src/heap/heap.cc#L5071).
+
+The configuration preserves CodSpeed's incremental-marking task settings; the
+additional `--no-incremental-marking-task` from the initial stabilization proposal
+has been removed.
+
+The flags are intentionally absent from ordinary Vitest timing and walltime runs.
+
+Changing simulation compiler settings changes the measurement baseline. Compare
+repeatability within each configuration before interpreting performance changes
+between configurations as router improvements or regressions.
+
+## Worker isolation
+
+Keep one SSR workload in each `speed*.bench.ts` file. These projects explicitly
+enable Vitest isolation; CodSpeed uses the forks pool, so every file receives a
+fresh worker. Multiple workloads in one file share the worker's runtime state,
+even though CodSpeed collects before each measurement. Later control cases
+remained noisy after the runtime flag corrections. Running the React plain
+dehydration and linked-CSS controls alone reduced their observed three-run spreads
+to 0.09% and 0.02% respectively.
+
+Variant files keep their workload names, request counts, concurrency, payloads
+and assertions. CodSpeed includes the file path in a benchmark's identity, so
+moved variants start a new history. The first workload keeps `speed.bench.ts`;
+the additional variants have descriptive file names alongside it. Type-check
+includes cover all of these files.
+
+## Streaming workload
+
+Deferred payloads in the SSR streaming scenario resolve after two task turns on
+Node. A real 1 ms timer lets elapsed host time decide which concurrent requests
+resolve together. Counted turns preserve the initial loading render and deferred
+payloads; the existing HTML assertions check both. These benchmarks execute in
+Node and use `setImmediate` directly.
+
+## Repeatability checks
+
+Dispatch the existing `Benchmarks` workflow against an unchanged branch:
+
+```sh
+gh workflow run benchmarks.yml --ref
+```
+
+Wait for each workflow run to finish before dispatching the next repetition at
+the same commit. The workflow also runs memory benchmarks; exclude those results
+when assessing CPU repeatability. Check that every repetition has all expected
+CPU results (currently 134), rather than inherited results from an earlier run.
+Compare each benchmark's minimum and maximum across repetitions; keep input data,
+navigation/request counts, builds, dependencies and Node version fixed when
+testing runtime configuration changes.
diff --git a/benchmarks/bundle-size/.gitignore b/benchmarks/bundle-size/.gitignore
index d5ced39aa3..bd05a98cee 100644
--- a/benchmarks/bundle-size/.gitignore
+++ b/benchmarks/bundle-size/.gitignore
@@ -6,4 +6,6 @@ scenarios/*/src/routeTree.gen.ts
results/*.json
results/*.md
results/*.js
+results/*.log
+results/runs/
!results/.gitkeep
diff --git a/benchmarks/bundle-size/README.md b/benchmarks/bundle-size/README.md
index 4d4d3dc2d3..2185d6b43f 100644
--- a/benchmarks/bundle-size/README.md
+++ b/benchmarks/bundle-size/README.md
@@ -29,29 +29,102 @@ Each package has `minimal` and `full` scenarios:
## Local Run
```bash
-pnpm nx run @benchmarks/bundle-size:build
+pnpm benchmark:bundle-size:run
```
Run one or more scenarios during local optimization:
```bash
-pnpm nx run @benchmarks/bundle-size:build -- --scenario react-router.minimal
-pnpm nx run @benchmarks/bundle-size:build -- --scenario react-router.minimal,react-router.full
+pnpm benchmark:bundle-size:run --scenario react-router.minimal
+pnpm benchmark:bundle-size:run --scenario react-router.minimal,react-router.full
```
-Filtered runs build only the package projects needed by selected scenarios. Full runs build all package projects needed by all scenarios. If the required packages are already built and unchanged, skip that step:
+The runner calls `measure.mjs`, which builds the selected package projects through Nx. Full runs build the package projects for all scenarios.
+`pnpm benchmark:bundle-size` uses the Nx build cache for the full benchmark, then generates `current.json` with the current commit, branch, dirty status, and report timestamp. CI uses this command as well.
+
+Nx caches the bundles, `measurements.json`, and `benchmark-action.json`. Git metadata does not affect the build cache. The report preserves the original `measuredAt` and build duration when measurements come from cache; `generatedAt` records when the report was generated. Running `pnpm nx run @benchmarks/bundle-size:measure` directly produces only the cacheable outputs; run `node scripts/benchmarks/bundle-size/report.mjs` afterward to refresh `current.json`.
+
+If the required packages are already built and unchanged, skip that step:
```bash
-pnpm nx run @benchmarks/bundle-size:build -- --scenario react-router.minimal --skip-package-builds
+pnpm benchmark:bundle-size:run --scenario react-router.minimal --skip-package-builds
```
This writes:
+- `benchmarks/bundle-size/results/measurements.json`
- `benchmarks/bundle-size/results/current.json`
- `benchmarks/bundle-size/results/benchmark-action.json`
+- `benchmarks/bundle-size/results/measure.log`
`current.json` includes run status, selected package build projects, per-scenario totals, per-file sizes, and the emitted JS files used for measurement. Dist paths use `scenarioDir`/`outDir`, e.g. `react-router.minimal` maps to `benchmarks/bundle-size/dist/react-router-minimal/`.
+The runner sets `CI=1` and `NX_DAEMON=false`. Successful runs print log locations and the existing `query` or `diff` summary.
+If a step fails, the runner stops with a nonzero exit code. It prints the last 40 log lines, limited to 8,000 characters.
+Full stdout and stderr stay in the log files. A positive bundle-size delta does not cause failure.
+
+For agent runs, use `pnpm --silent benchmark:bundle-size:run ...` to omit the package-manager command echo.
+
+### Phase Timings
+
+To diagnose measurement time, request a fresh run:
+
+```bash
+pnpm benchmark:bundle-size:run --scenario react-router.minimal --analysis --timings
+```
+
+The runner directly executes `measure.mjs` on every invocation, rebuilding the selected scenarios and recording fresh timings in `measure.log`. Its package-build step still uses Nx and may restore cached packages. Use `--skip-package-builds` only when those packages are already built and unchanged.
+
+`measure.mjs` also accepts `--timings` directly. Alternatively, set `BUNDLE_SIZE_TIMINGS=1`. Timing lines go to stderr with the prefix `[bundle-size:timing]` followed by JSON containing `phase`, `durationMs`, and, for scenario phases, `scenario`. They are diagnostics only and do not add fields to the size metrics.
+
+The cached `pnpm benchmark:bundle-size` / Nx build path can replay terminal output from an earlier execution, including old timing lines. Setting `BUNDLE_SIZE_TIMINGS=1` does not invalidate that cache or guarantee fresh timings. Use the direct runner above for timing investigations; refreshing `current.json` after a cache hit does not remeasure build time.
+
+- `package-builds`: elapsed time for the package-build invocation, including Nx startup/cache handling; omitted when package builds are skipped.
+- `scenario-build`: elapsed time for each scenario's build and cleanup.
+- `manifest-resolution`: manifest discovery, parsing, entry selection, and collection of all/initial JS file lists.
+- `gzip` / `brotli`: accumulated codec time across distinct files for each scenario, using Node's default compression settings. File reads and summation are excluded; initial files reuse already measured sizes.
+- `analysis`: source attribution, when `--analysis` is enabled.
+- `overall`: measurement execution through report/history writing. Module imports, process startup, and the outer runner's tests/report command are excluded.
+
+Phases that start also report elapsed work on failure; compression reports partial accumulated times before propagating the error. Timing records alone do not indicate success. `overall` contains the other phases, so nested timings must not be added to it. The phase breakdown also excludes overhead such as file reads and result writing, so its sum is not expected to equal `overall`.
+
+## Compare Optimization Candidates
+
+Before you change the implementation, save a named baseline:
+
+```bash
+pnpm benchmark:bundle-size:run --name baseline --scenario react-router.minimal,react-router.full
+```
+
+After you change the implementation, compare a candidate against that baseline:
+
+```bash
+pnpm benchmark:bundle-size:run --name candidate --baseline baseline \
+ --scenario react-router.minimal,react-router.full \
+ --test-projects @tanstack/router-core,@tanstack/react-router \
+ -- tests/path.test.ts tests/link.test.tsx
+```
+
+`--test-projects` runs the selected Nx unit-test targets before measurement. Arguments after `--` go only to those tests.
+Tests and measurement run sequentially. Failed tests stop the runner before measurement, so old results cannot produce a misleading diff.
+Without `--test-projects`, the runner only measures bundles. Type tests, performance benchmarks, and e2e tests remain separate commands.
+
+Named runs store their metrics and logs in `benchmarks/bundle-size/results/runs//`. Existing named results cannot be overwritten.
+Without `--name`, runs replace `current.json` and the logs for the steps they run.
+Emitted bundles still use the shared `dist/` directory. To retain emitted bundles for a candidate, pass a separate `--dist-dir`.
+
+`--baseline` accepts a run name or a JSON file path, such as `--baseline ./baseline.json`.
+With `--scenario`, the comparison reports only the scenarios measured in the current run, even when the baseline contains more scenarios. Selected scenarios missing from the baseline remain visible with `n/a` for their baseline and deltas.
+Without `--scenario`, comparisons include scenarios from either result file.
+`--results-dir ` changes the results root, including the location of named runs.
+Use the same scenario selection and measurement flags for the baseline and candidate.
+
+For command reference, run:
+
+```bash
+pnpm benchmark:bundle-size:run --help
+```
+
## Local Query Tools
```bash
@@ -60,18 +133,22 @@ pnpm benchmark:bundle-size:diff --baseline /tmp/base-current.json --id react-rou
pnpm benchmark:bundle-size:history --id react-router.minimal --top-deltas 20
```
+Use `pnpm benchmark:bundle-size:diff --baseline /tmp/base-current.json --current-only` to compare only scenarios present in the current results. This applies to both text and `--json` output; an explicit `--id` takes precedence.
+
For source attribution, run an analysis build. This uses hidden source maps and writes source estimates into `current.json`; those estimates are for investigation only, not tracking.
```bash
-pnpm nx run @benchmarks/bundle-size:build -- --scenario react-router.minimal --analysis
+pnpm benchmark:bundle-size:run --scenario react-router.minimal --analysis
pnpm benchmark:bundle-size:analyze --id react-router.minimal --top-sources 30
```
+For a named run, pass `--current benchmarks/bundle-size/results/runs//current.json` to `query`, `diff`, or `analyze`.
+
## CI Reporting
- PR workflow generates a sticky comment with:
- - current gzip values
- - baseline delta
+ - current gzip, initial gzip, raw, and Brotli values
+ - per-metric deltas from the `main` baseline
- inline sparkline trend
- Pushes to `main` publish historical chart data to GitHub Pages via `benchmark-action/github-action-benchmark`.
diff --git a/benchmarks/bundle-size/package.json b/benchmarks/bundle-size/package.json
index 47d61512b4..ca34cd6cd7 100644
--- a/benchmarks/bundle-size/package.json
+++ b/benchmarks/bundle-size/package.json
@@ -3,17 +3,35 @@
"private": true,
"type": "module",
"scripts": {
- "build": "node ../../scripts/benchmarks/bundle-size/measure.mjs --skip-package-builds",
- "test:unit": "node --test ../../scripts/benchmarks/bundle-size/pr-report.test.mjs"
+ "measure": "node ../../scripts/benchmarks/bundle-size/measure.mjs --skip-package-builds --measurements-only",
+ "test:unit": "node --test ../../scripts/benchmarks/bundle-size/pr-report.test.mjs ../../scripts/benchmarks/bundle-size/run.test.mjs ../../scripts/benchmarks/bundle-size/report.test.mjs ../../scripts/benchmarks/bundle-size/build.test.mjs ../../scripts/benchmarks/bundle-size/compress.test.mjs ../../scripts/benchmarks/bundle-size/timings.test.mjs"
},
"nx": {
"targets": {
- "build": {
- "cache": false,
+ "measure": {
+ "cache": true,
+ "inputs": [
+ "buildProduction",
+ "^buildProduction",
+ "dependentTaskOutputs",
+ "{workspaceRoot}/scripts/benchmarks/bundle-size/measure.mjs",
+ "{workspaceRoot}/scripts/benchmarks/bundle-size/compress.mjs",
+ "{workspaceRoot}/scripts/benchmarks/bundle-size/timings.mjs",
+ "{workspaceRoot}/scripts/benchmarks/bundle-size/report.mjs",
+ {
+ "runtime": "node --version"
+ }
+ ],
+ "outputs": [
+ "{projectRoot}/dist",
+ "{projectRoot}/results/measurements.json",
+ "{projectRoot}/results/benchmark-action.json"
+ ],
"dependsOn": [
{
"projects": [
"@tanstack/react-router",
+ "@tanstack/react-router-ssr-query",
"@tanstack/react-start",
"@tanstack/router-plugin",
"@tanstack/solid-router",
@@ -26,32 +44,32 @@
]
},
"test:unit": {
+ "dependsOn": [],
"inputs": [
"default",
"^production",
- "{workspaceRoot}/scripts/benchmarks/bundle-size/pr-report.mjs",
- "{workspaceRoot}/scripts/benchmarks/bundle-size/pr-report.test.mjs"
+ "{workspaceRoot}/scripts/benchmarks/bundle-size/*.mjs"
]
}
}
},
"dependencies": {
- "@solidjs/web": "^2.0.0-rc.20",
"@tanstack/react-router": "workspace:^",
- "@tanstack/react-start": "workspace:^",
+ "@tanstack/react-router-ssr-query": "workspace:^",
"@tanstack/solid-router": "workspace:^",
- "@tanstack/solid-start": "workspace:^",
"@tanstack/vue-router": "workspace:^",
+ "@tanstack/react-start": "workspace:^",
+ "@tanstack/solid-start": "workspace:^",
"@tanstack/vue-start": "workspace:^",
+ "@tanstack/react-query": "catalog:",
"react": "^19.0.0",
"react-dom": "^19.0.0",
- "solid-js": "^2.0.0-rc.20",
+ "solid-js": "^1.9.10",
"vue": "^3.5.16"
},
"devDependencies": {
- "@rsbuild/core": "^2.1.0",
+ "@rsbuild/core": "^2.3.1",
"@rsbuild/plugin-react": "^2.0.0",
- "@solidjs/vite-plugin": "^3.0.0-next.54",
"@tanstack/router-plugin": "workspace:^",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
@@ -60,6 +78,7 @@
"@vitejs/plugin-vue-jsx": "^5.1.5",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
- "vite": "^8.0.14"
+ "vite": "^8.0.14",
+ "vite-plugin-solid": "^2.11.11"
}
}
diff --git a/benchmarks/bundle-size/scenarios/react-start-full/rsbuild.config.ts b/benchmarks/bundle-size/scenarios/react-start-full/rsbuild.config.ts
index 641de56234..349e11bec1 100644
--- a/benchmarks/bundle-size/scenarios/react-start-full/rsbuild.config.ts
+++ b/benchmarks/bundle-size/scenarios/react-start-full/rsbuild.config.ts
@@ -6,7 +6,7 @@ const outDir = process.env.BUNDLE_SIZE_DIST_DIR ?? 'dist-rsbuild'
export default defineConfig({
logLevel: 'silent',
- plugins: [pluginReact({ splitChunks: false }), tanstackStart()],
+ plugins: [pluginReact(), tanstackStart()],
output: {
distPath: {
root: outDir,
diff --git a/benchmarks/bundle-size/scenarios/react-start-minimal/rsbuild.config.ts b/benchmarks/bundle-size/scenarios/react-start-minimal/rsbuild.config.ts
index 78752d0190..7d27421d4d 100644
--- a/benchmarks/bundle-size/scenarios/react-start-minimal/rsbuild.config.ts
+++ b/benchmarks/bundle-size/scenarios/react-start-minimal/rsbuild.config.ts
@@ -16,7 +16,7 @@ const startOptions = clientOutput
export default defineConfig({
logLevel: 'silent',
- plugins: [pluginReact({ splitChunks: false }), tanstackStart(startOptions)],
+ plugins: [pluginReact(), tanstackStart(startOptions)],
output: {
distPath: {
root: outDir,
diff --git a/benchmarks/bundle-size/scenarios/react-start-query-integration/src/router.tsx b/benchmarks/bundle-size/scenarios/react-start-query-integration/src/router.tsx
new file mode 100644
index 0000000000..93b95f3148
--- /dev/null
+++ b/benchmarks/bundle-size/scenarios/react-start-query-integration/src/router.tsx
@@ -0,0 +1,17 @@
+import { QueryClient } from '@tanstack/react-query'
+import { createRouter } from '@tanstack/react-router'
+import { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'
+import { routeTree } from './routeTree.gen'
+
+export function getRouter() {
+ const queryClient = new QueryClient()
+ const router = createRouter({
+ routeTree,
+ context: { queryClient },
+ scrollRestoration: true,
+ })
+
+ setupRouterSsrQueryIntegration({ router, queryClient })
+
+ return router
+}
diff --git a/benchmarks/bundle-size/scenarios/react-start-query-integration/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/react-start-query-integration/src/routes/__root.tsx
new file mode 100644
index 0000000000..ff1da4c304
--- /dev/null
+++ b/benchmarks/bundle-size/scenarios/react-start-query-integration/src/routes/__root.tsx
@@ -0,0 +1,24 @@
+import {
+ HeadContent,
+ Outlet,
+ Scripts,
+ createRootRoute,
+} from '@tanstack/react-router'
+
+export const Route = createRootRoute({
+ component: RootComponent,
+})
+
+function RootComponent() {
+ return (
+
+
+
+
+
+
+
+
+
+ )
+}
diff --git a/benchmarks/bundle-size/scenarios/react-start-query-integration/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/react-start-query-integration/src/routes/index.tsx
new file mode 100644
index 0000000000..76fb363538
--- /dev/null
+++ b/benchmarks/bundle-size/scenarios/react-start-query-integration/src/routes/index.tsx
@@ -0,0 +1,9 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/')({
+ component: IndexComponent,
+})
+
+function IndexComponent() {
+ return hello world
+}
diff --git a/benchmarks/bundle-size/scenarios/react-start-query-integration/vite.config.ts b/benchmarks/bundle-size/scenarios/react-start-query-integration/vite.config.ts
new file mode 100644
index 0000000000..d4e4cd980d
--- /dev/null
+++ b/benchmarks/bundle-size/scenarios/react-start-query-integration/vite.config.ts
@@ -0,0 +1,7 @@
+import { defineConfig } from 'vite'
+import viteReact from '@vitejs/plugin-react'
+import { tanstackStart } from '@tanstack/react-start/plugin/vite'
+
+export default defineConfig({
+ plugins: [tanstackStart(), viteReact()],
+})
diff --git a/benchmarks/bundle-size/scenarios/solid-router-full/src/main.tsx b/benchmarks/bundle-size/scenarios/solid-router-full/src/main.tsx
index eaa48dd6c1..505f79aee0 100644
--- a/benchmarks/bundle-size/scenarios/solid-router-full/src/main.tsx
+++ b/benchmarks/bundle-size/scenarios/solid-router-full/src/main.tsx
@@ -1,4 +1,4 @@
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { RouterProvider, createRouter } from '@tanstack/solid-router'
import { routeTree } from './routeTree.gen'
diff --git a/benchmarks/bundle-size/scenarios/solid-router-full/vite.config.ts b/benchmarks/bundle-size/scenarios/solid-router-full/vite.config.ts
index c536beefe7..9729ada0e8 100644
--- a/benchmarks/bundle-size/scenarios/solid-router-full/vite.config.ts
+++ b/benchmarks/bundle-size/scenarios/solid-router-full/vite.config.ts
@@ -1,5 +1,5 @@
import { defineConfig } from 'vite'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
export default defineConfig({
diff --git a/benchmarks/bundle-size/scenarios/solid-router-minimal/src/main.tsx b/benchmarks/bundle-size/scenarios/solid-router-minimal/src/main.tsx
index f7c0b4bc7f..210120b3f1 100644
--- a/benchmarks/bundle-size/scenarios/solid-router-minimal/src/main.tsx
+++ b/benchmarks/bundle-size/scenarios/solid-router-minimal/src/main.tsx
@@ -1,4 +1,4 @@
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { RouterProvider, createRouter } from '@tanstack/solid-router'
import { routeTree } from './routeTree.gen'
diff --git a/benchmarks/bundle-size/scenarios/solid-router-minimal/vite.config.ts b/benchmarks/bundle-size/scenarios/solid-router-minimal/vite.config.ts
index c536beefe7..9729ada0e8 100644
--- a/benchmarks/bundle-size/scenarios/solid-router-minimal/vite.config.ts
+++ b/benchmarks/bundle-size/scenarios/solid-router-minimal/vite.config.ts
@@ -1,5 +1,5 @@
import { defineConfig } from 'vite'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
export default defineConfig({
diff --git a/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/vite.config.ts b/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/vite.config.ts
index 8c3cc043ea..0bd21e64f4 100644
--- a/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/vite.config.ts
+++ b/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/vite.config.ts
@@ -1,5 +1,5 @@
import { defineConfig } from 'vite'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import { tanstackStart } from '@tanstack/solid-start/plugin/vite'
export default defineConfig({
diff --git a/benchmarks/bundle-size/scenarios/solid-start-full/vite.config.ts b/benchmarks/bundle-size/scenarios/solid-start-full/vite.config.ts
index 8c3cc043ea..0bd21e64f4 100644
--- a/benchmarks/bundle-size/scenarios/solid-start-full/vite.config.ts
+++ b/benchmarks/bundle-size/scenarios/solid-start-full/vite.config.ts
@@ -1,5 +1,5 @@
import { defineConfig } from 'vite'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import { tanstackStart } from '@tanstack/solid-start/plugin/vite'
export default defineConfig({
diff --git a/benchmarks/bundle-size/scenarios/solid-start-minimal/vite.config.ts b/benchmarks/bundle-size/scenarios/solid-start-minimal/vite.config.ts
index 8c3cc043ea..0bd21e64f4 100644
--- a/benchmarks/bundle-size/scenarios/solid-start-minimal/vite.config.ts
+++ b/benchmarks/bundle-size/scenarios/solid-start-minimal/vite.config.ts
@@ -1,5 +1,5 @@
import { defineConfig } from 'vite'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import { tanstackStart } from '@tanstack/solid-start/plugin/vite'
export default defineConfig({
diff --git a/benchmarks/bundle-size/scenarios/vue-router-full/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/vue-router-full/src/routes/__root.tsx
index d696063083..0ff40aebfc 100644
--- a/benchmarks/bundle-size/scenarios/vue-router-full/src/routes/__root.tsx
+++ b/benchmarks/bundle-size/scenarios/vue-router-full/src/routes/__root.tsx
@@ -1,3 +1,4 @@
+import { defineComponent } from 'vue'
import {
Asset,
Await,
@@ -45,143 +46,151 @@ import {
useTags,
} from '@tanstack/vue-router'
+const RootComponent = defineComponent({
+ setup() {
+ const router = useRouter()
+ const [awaited] = useAwaited({ promise: Promise.resolve('ready') })
+ const linkProps = useLinkProps({ to: '/' } as any)
+ const matchRoute = useMatchRoute()
+ const matches = useMatches()
+ const parentMatches = useParentMatches()
+ const childMatches = useChildMatches()
+ const match = useMatch({ strict: false, shouldThrow: false } as any)
+ const loaderDeps = useLoaderDeps({ strict: false } as any)
+ const loaderData = useLoaderData({ strict: false } as any)
+ const params = useParams({ strict: false } as any)
+ const search = useSearch({ strict: false } as any)
+ const routeContext = useRouteContext({ strict: false } as any)
+ const routerState = useRouterState({
+ select: (state) => state.status,
+ } as any)
+ const location = useLocation()
+ const canGoBack = useCanGoBack()
+ const navigate = useNavigate()
+ const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' })
+ const tags = useTags()
+
+ useBlocker({
+ shouldBlockFn: () => false,
+ disabled: true,
+ withResolver: false,
+ })
+
+ const linkFactoryResult = linkOptions({ to: '/' } as any)
+ const routeMatchResult = matchRoute({ to: '/' } as any)
+ const SvgLink = createLink('svg')
+
+ const hooksAndComponents = [
+ useAwaited,
+ useLinkProps,
+ useMatchRoute,
+ useMatches,
+ useParentMatches,
+ useChildMatches,
+ useMatch,
+ useLoaderDeps,
+ useLoaderData,
+ useBlocker,
+ useNavigate,
+ useParams,
+ useSearch,
+ useRouteContext,
+ useRouter,
+ useRouterState,
+ useLocation,
+ useCanGoBack,
+ useElementScrollRestoration,
+ useTags,
+ Await,
+ CatchBoundary,
+ CatchNotFound,
+ ClientOnly,
+ DefaultGlobalNotFound,
+ ErrorComponent,
+ Link,
+ Match,
+ MatchRoute,
+ Matches,
+ Navigate,
+ Outlet,
+ RouterContextProvider,
+ ScrollRestoration,
+ Block,
+ ScriptOnce,
+ Asset,
+ HeadContent,
+ Scripts,
+ Body,
+ Html,
+ ]
+
+ ;(globalThis as any).__TANSTACK_BUNDLE_SIZE_KEEP__ = {
+ hooksAndComponents,
+ }
+
+ return () => {
+ void awaited
+ void linkFactoryResult
+ void matches.value
+ void parentMatches.value
+ void childMatches.value
+ void match.value
+ void loaderDeps.value
+ void loaderData.value
+ void params.value
+ void search.value
+ void routeContext.value
+ void routerState.value
+ void location.value
+ void canGoBack.value
+ void navigate
+ void scrollEntry
+ void tags()
+ void routeMatchResult.value
+
+ return (
+ <>
+
+ {'window.__tsr_bundle_size = true'}
+
+ home
+
+
+
+
+ {() => }
+
+ }>
+
+
+ }
+ />
+ false} disabled withResolver={false}>
+ {() => }
+
+ }>
+
+
+
+
+
+
+
+
+
+ >
+ )
+ }
+ },
+})
+
export const Route = createRootRoute({
component: RootComponent,
})
-
-function RootComponent() {
- const router = useRouter()
- const [awaited] = useAwaited({ promise: Promise.resolve('ready') })
- const linkProps = useLinkProps({ to: '/' } as any)
- const matchRoute = useMatchRoute()
- const matches = useMatches()
- const parentMatches = useParentMatches()
- const childMatches = useChildMatches()
- const match = useMatch({ strict: false, shouldThrow: false } as any)
- const loaderDeps = useLoaderDeps({ strict: false } as any)
- const loaderData = useLoaderData({ strict: false } as any)
- const params = useParams({ strict: false } as any)
- const search = useSearch({ strict: false } as any)
- const routeContext = useRouteContext({ strict: false } as any)
- const routerState = useRouterState({ select: (state) => state.status } as any)
- const location = useLocation()
- const canGoBack = useCanGoBack()
- const navigate = useNavigate()
- const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' })
- const tags = useTags()
-
- useBlocker({
- shouldBlockFn: () => false,
- disabled: true,
- withResolver: false,
- })
-
- const linkFactoryResult = linkOptions({ to: '/' } as any)
- const routeMatchResult = matchRoute({ to: '/' } as any)
- const SvgLink = createLink('svg')
-
- const hooksAndComponents = [
- useAwaited,
- useLinkProps,
- useMatchRoute,
- useMatches,
- useParentMatches,
- useChildMatches,
- useMatch,
- useLoaderDeps,
- useLoaderData,
- useBlocker,
- useNavigate,
- useParams,
- useSearch,
- useRouteContext,
- useRouter,
- useRouterState,
- useLocation,
- useCanGoBack,
- useElementScrollRestoration,
- useTags,
- Await,
- CatchBoundary,
- CatchNotFound,
- ClientOnly,
- DefaultGlobalNotFound,
- ErrorComponent,
- Link,
- Match,
- MatchRoute,
- Matches,
- Navigate,
- Outlet,
- RouterContextProvider,
- ScrollRestoration,
- Block,
- ScriptOnce,
- Asset,
- HeadContent,
- Scripts,
- Body,
- Html,
- ]
-
- ;(globalThis as any).__TANSTACK_BUNDLE_SIZE_KEEP__ = {
- hooksAndComponents,
- }
-
- void awaited
- void linkFactoryResult
- void matches.value
- void parentMatches.value
- void childMatches.value
- void match.value
- void loaderDeps.value
- void loaderData.value
- void params.value
- void search.value
- void routeContext.value
- void routerState.value
- void location.value
- void canGoBack.value
- void navigate
- void scrollEntry
- void tags()
- void routeMatchResult.value
-
- return (
- <>
-
- {'window.__tsr_bundle_size = true'}
-
- home
-
-
-
- {() => }
- }>
-
-
- }
- />
- false} disabled withResolver={false}>
- {() => }
-
- }>
-
-
-
-
-
-
-
-
-
- >
- )
-}
diff --git a/benchmarks/bundle-size/scenarios/vue-start-full/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/vue-start-full/src/routes/__root.tsx
index aa0539fa1a..8e8870a2ce 100644
--- a/benchmarks/bundle-size/scenarios/vue-start-full/src/routes/__root.tsx
+++ b/benchmarks/bundle-size/scenarios/vue-start-full/src/routes/__root.tsx
@@ -1,3 +1,4 @@
+import { defineComponent } from 'vue'
import {
Asset,
Await,
@@ -68,151 +69,159 @@ const helloServerFn = createServerFn({ method: 'GET' })
return 'hello from server fn'
})
+const RootComponent = defineComponent({
+ setup() {
+ const router = useRouter()
+ const [awaited] = useAwaited({ promise: Promise.resolve('ready') })
+ const linkProps = useLinkProps({ to: '/' } as any)
+ const matchRoute = useMatchRoute()
+ const matches = useMatches()
+ const parentMatches = useParentMatches()
+ const childMatches = useChildMatches()
+ const match = useMatch({ strict: false, shouldThrow: false } as any)
+ const loaderDeps = useLoaderDeps({ strict: false } as any)
+ const loaderData = useLoaderData({ strict: false } as any)
+ const params = useParams({ strict: false } as any)
+ const search = useSearch({ strict: false } as any)
+ const routeContext = useRouteContext({ strict: false } as any)
+ const routerState = useRouterState({
+ select: (state) => state.status,
+ } as any)
+ const location = useLocation()
+ const canGoBack = useCanGoBack()
+ const navigate = useNavigate()
+ const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' })
+ const tags = useTags()
+ const invokeServerFn = useServerFn(helloServerFn)
+
+ useBlocker({
+ shouldBlockFn: () => false,
+ disabled: true,
+ withResolver: false,
+ })
+
+ const linkFactoryResult = linkOptions({ to: '/' } as any)
+ const routeMatchResult = matchRoute({ to: '/' } as any)
+ const SvgLink = createLink('svg')
+
+ const startSurface = [createMiddleware, createServerFn, useServerFn]
+ const hooksAndComponents = [
+ useAwaited,
+ useLinkProps,
+ useMatchRoute,
+ useMatches,
+ useParentMatches,
+ useChildMatches,
+ useMatch,
+ useLoaderDeps,
+ useLoaderData,
+ useBlocker,
+ useNavigate,
+ useParams,
+ useSearch,
+ useRouteContext,
+ useRouter,
+ useRouterState,
+ useLocation,
+ useCanGoBack,
+ useElementScrollRestoration,
+ useTags,
+ Await,
+ CatchBoundary,
+ CatchNotFound,
+ ClientOnly,
+ DefaultGlobalNotFound,
+ ErrorComponent,
+ Link,
+ Match,
+ MatchRoute,
+ Matches,
+ Navigate,
+ Outlet,
+ RouterContextProvider,
+ ScrollRestoration,
+ Block,
+ ScriptOnce,
+ Asset,
+ HeadContent,
+ Scripts,
+ Body,
+ Html,
+ ]
+
+ ;(globalThis as any).__TANSTACK_BUNDLE_SIZE_KEEP__ = {
+ hooksAndComponents,
+ startSurface,
+ }
+
+ return () => {
+ void awaited
+ void linkFactoryResult
+ void matches.value
+ void parentMatches.value
+ void childMatches.value
+ void match.value
+ void loaderDeps.value
+ void loaderData.value
+ void params.value
+ void search.value
+ void routeContext.value
+ void routerState.value
+ void location.value
+ void canGoBack.value
+ void navigate
+ void scrollEntry
+ void tags()
+ void routeMatchResult.value
+ void invokeServerFn
+
+ return (
+
+
+
+
+
+ {'window.__tsr_bundle_size = true'}
+
+ home
+
+
+
+
+ {() => }
+
+ }>
+
+
+ }
+ />
+ false} disabled withResolver={false}>
+ {() => }
+
+ }>
+
+
+
+
+
+
+
+
+
+
+
+ )
+ }
+ },
+})
+
export const Route = createRootRoute({
component: RootComponent,
})
-
-function RootComponent() {
- const router = useRouter()
- const [awaited] = useAwaited({ promise: Promise.resolve('ready') })
- const linkProps = useLinkProps({ to: '/' } as any)
- const matchRoute = useMatchRoute()
- const matches = useMatches()
- const parentMatches = useParentMatches()
- const childMatches = useChildMatches()
- const match = useMatch({ strict: false, shouldThrow: false } as any)
- const loaderDeps = useLoaderDeps({ strict: false } as any)
- const loaderData = useLoaderData({ strict: false } as any)
- const params = useParams({ strict: false } as any)
- const search = useSearch({ strict: false } as any)
- const routeContext = useRouteContext({ strict: false } as any)
- const routerState = useRouterState({ select: (state) => state.status } as any)
- const location = useLocation()
- const canGoBack = useCanGoBack()
- const navigate = useNavigate()
- const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' })
- const tags = useTags()
- const invokeServerFn = useServerFn(helloServerFn)
-
- useBlocker({
- shouldBlockFn: () => false,
- disabled: true,
- withResolver: false,
- })
-
- const linkFactoryResult = linkOptions({ to: '/' } as any)
- const routeMatchResult = matchRoute({ to: '/' } as any)
- const SvgLink = createLink('svg')
-
- const startSurface = [createMiddleware, createServerFn, useServerFn]
- const hooksAndComponents = [
- useAwaited,
- useLinkProps,
- useMatchRoute,
- useMatches,
- useParentMatches,
- useChildMatches,
- useMatch,
- useLoaderDeps,
- useLoaderData,
- useBlocker,
- useNavigate,
- useParams,
- useSearch,
- useRouteContext,
- useRouter,
- useRouterState,
- useLocation,
- useCanGoBack,
- useElementScrollRestoration,
- useTags,
- Await,
- CatchBoundary,
- CatchNotFound,
- ClientOnly,
- DefaultGlobalNotFound,
- ErrorComponent,
- Link,
- Match,
- MatchRoute,
- Matches,
- Navigate,
- Outlet,
- RouterContextProvider,
- ScrollRestoration,
- Block,
- ScriptOnce,
- Asset,
- HeadContent,
- Scripts,
- Body,
- Html,
- ]
-
- ;(globalThis as any).__TANSTACK_BUNDLE_SIZE_KEEP__ = {
- hooksAndComponents,
- startSurface,
- }
-
- void awaited
- void linkFactoryResult
- void matches.value
- void parentMatches.value
- void childMatches.value
- void match.value
- void loaderDeps.value
- void loaderData.value
- void params.value
- void search.value
- void routeContext.value
- void routerState.value
- void location.value
- void canGoBack.value
- void navigate
- void scrollEntry
- void tags()
- void routeMatchResult.value
- void invokeServerFn
-
- return (
-
-
-
-
-
- {'window.__tsr_bundle_size = true'}
-
- home
-
-
-
- {() => }
- }>
-
-
- }
- />
- false} disabled withResolver={false}>
- {() => }
-
- }>
-
-
-
-
-
-
-
-
-
-
-
- )
-}
diff --git a/benchmarks/client-nav/README.md b/benchmarks/client-nav/README.md
index 6179c7f0b8..ec34ecc0c1 100644
--- a/benchmarks/client-nav/README.md
+++ b/benchmarks/client-nav/README.md
@@ -9,10 +9,11 @@ Cross-framework client-side CPU benchmarks for:
The benchmarks run in jsdom against production builds of real apps, and are
tracked in CI by CodSpeed (simulation mode).
-> **Scope:** these benchmarks cover the standalone client router only. The
-> client side of TanStack Start (hydration of a server-rendered document,
-> streamed payload consumption, server-function calls from the client, ...) is
-> not covered here; the server side of Start is covered by `benchmarks/ssr`.
+> **Scope:** these benchmarks cover the client router. The hydration
+> scenarios also cover DOM hydration and the Router state-restoration path
+> used by Start. Start-specific entry-point initialization, streamed payload
+> arrival and client server-function calls are not included. Server request work
+> is covered by `benchmarks/ssr`.
## Layout
@@ -38,7 +39,7 @@ scenarios///
routes/
```
-Scenario apps use file-based routing (`@tanstack/router-plugin`) with a
+Navigation scenario apps use file-based routing (`@tanstack/router-plugin`) with a
generated `routeTree.gen.ts`, like a regular user app. Each scenario uses one
app per framework instead of sharing routes in the baseline app. This keeps
route-tree size and router options isolated so one scenario cannot shift
@@ -57,9 +58,11 @@ be attributed to a specific feature area.
| `control-flow` | Loader-thrown `redirect` (including a 2-hop chain), `notFound()` with `notFoundComponent`, loader errors with `errorComponent`, and boundary reset on recovery navigation. |
| `head` | `HeadContent` per-navigation work: nested route `head()` evaluation, title/meta/link dedupe across matches, and head tag DOM updates during navigation. |
| `history` | History push/replace/back/forward traversal, location masking, registered-but-never-blocking `useBlocker`, and `useCanGoBack`/`useLocation` subscriptions. |
+| `hydration` | Initial DOM hydration: execute the SSR payload, restore `beforeLoad` context and loader data, and hydrate 192 ordinary and eight hash-sensitive Links through their follow-up effects in React and Solid. |
+| `link-churn` | Links that depart, stay and mount: 30 `/hub` layout Links stay while 100 `/hub/list` leaf Links leave (alone, or with the layout to `/other`) and remount on return; a search-only change rebuilds updater and `to="."` Links. Unlike `links`, whose root-layout Links never depart. |
| `links` | Per-navigation cost of ~200 mounted ` `s: link prop building, active-state recompute across `activeOptions` variants, `activeProps` swaps, and `useMatchRoute` probes (the `MatchRoute` component is avoided: vue-router's implementation leaks one subscription per render). |
| `loaders` | Client loader dispatch: always-stale re-runs (`staleTime: 0`), cached revisits (re-run once per lap by the `invalidate` step), `loaderDeps`-keyed caching, `router.invalidate()`, and `useLoaderData` selectors. |
-| `mount` | Cold start: `createRouter` (route-tree processing) + first render + initial `router.load()` + unmount, with a fresh router per mount. The only scenario measuring router creation. |
+| `mount` | Cold start: `createRouter` (route-tree processing) + first render + initial `router.load()` + unmount, with a fresh router per mount. |
| `nested-params` | Deep nesting (8 dynamic levels): per-level `params.parse`/`stringify`, `beforeLoad` context accumulation across matches, and per-level `useParams`/`useRouteContext` subscriptions. Param values include characters requiring percent-encoding (as do `route-tree-scale`'s), so segment encode/decode paths run on every navigation. |
| `preload` | Intent preloading from hover events, programmatic `router.preloadRoute`, deterministic preload cache behavior (`defaultPreloadStaleTime: 0`), and commit-time cache maintenance. |
| `rewrites` | Composed client-side location rewrites: router `basepath` plus a locale input/output rewrite pair, running on every href build and location parse (the client analog of the SSR `rewrites` scenario). |
@@ -68,10 +71,14 @@ be attributed to a specific feature area.
## Conventions
+The hydration scenario has the separate lifecycle described below. The other
+scenarios follow these navigation/mount conventions:
+
- Apps are built with `NODE_ENV=production` (`minify: false`) into `dist/app.js`; benches import the built bundle, so production package builds and production JSX output are measured, not dev transforms.
- Scenarios behave like a real user app: navigation happens through ` ` clicks dispatched on real anchor elements (unless a scenario specifically measures the imperative API), the router uses the default browser history, and `scrollRestoration` is enabled.
- Each benchmark iteration advances a fixed, circular sequence of steps; every step awaits the router's `onRendered` event, so render work is included and steps cannot overlap. No two consecutive steps may target the same location, and the sequence ends back on the initial route.
- Setup runs one warm-up lap through the sequence and asserts each step's observable output (e.g. `document.title`), so a scenario that silently stops doing its work fails instead of reporting a fast time.
+- Apps are mounted and disposed outside timing by `benchLifecycle` (`benchmarks/cpu-simulation.ts`): CodSpeed measures a single invocation, so every invocation gets a freshly mounted app; plain `vitest bench` keeps one app per warmup/run phase. Bench functions must be `async` functions, because CodSpeed's Vitest 5 provider awaits only `AsyncFunction`s.
- Determinism: no wall-clock timers (async work is resolved promises or counted `setTimeout(0)` hops), `staleTime`/`gcTime` only ever `0` or effectively-infinite, no `Math.random`/`Date.now` in the measured loop. Scroll restoration uses `getScrollRestorationKey: (location) => location.pathname` so its cache stays bounded (the default random per-entry key grows one cache entry per push navigation). The `mount` scenario opts out of `scrollRestoration` entirely and destroys its history on unmount — both register page-lifetime globals that would leak across its mount/unmount loop.
- Push-only step laps grow jsdom's session-history entry list over a run (jsdom never truncates entries behind the current index). Per-push cost stays O(1) so timings are unaffected; only the `history` scenario needs — and has — a lap that is depth-stationary.
- Calibration: pick per-iteration step counts so a bench's `vitest bench` run stays roughly between 8 and 30 seconds (long enough to average out, short enough for CI).
@@ -96,7 +103,7 @@ Run a single scenario app manually (after building it through Nx):
```bash
CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav--:build:client --outputStyle=stream --skipRemoteCache
-cd benchmarks/client-nav && NODE_ENV=production vitest bench --config ./scenarios///vite.config.ts
+cd benchmarks/client-nav && NODE_ENV=production vitest bench --mode benchmark --config ./scenarios///vite.config.ts
```
Run framework-specific flame benchmarks (10 second loop, profiled with `@platformatic/flame`, forced to `NODE_ENV=production`):
@@ -115,3 +122,186 @@ Typecheck benchmark sources (baseline + scenarios):
```bash
CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:types --outputStyle=stream --skipRemoteCache
```
+
+## Hydration
+
+`scenarios/hydration/{react,solid}` provide the same initial-hydration
+workload: 192 ordinary Links, eight hash-sensitive Links, and three matched
+routes with three `beforeLoad` contexts and two loader results. The server URL
+has no fragment; the client URL has `#details`, matching half of the hash-sensitive Links.
+
+```bash
+CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav-hydration-react:test:perf --outputStyle=stream --skipRemoteCache
+CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav-hydration-react:test:unit --outputStyle=stream --skipRemoteCache
+CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav-hydration-react:test:types:client --outputStyle=stream --skipRemoteCache
+```
+
+Replace `react` with `solid` to run the other adapter.
+
+The build generates static HTML and its real Router SSR bootstrap scripts once
+with `createRequestHandler` and the adapter's streaming renderer. Generation
+fully consumes the response and runs outside the CodSpeed action. The measured
+worker only reads these artifacts; it does not import a server renderer or start a server.
+
+Each invocation uses a fresh jsdom window and a fresh evaluation of the complete
+production client bundle in that window's realm. HTML parsing, bundle evaluation,
+and the initial document lifecycle finish in untimed setup. This resets module
+state as well as the DOM, avoiding cached hydration promises and cross-realm
+payload objects. The bundle and bootstrap scripts are compiled once, so this
+measures a fresh application with warm code, not JavaScript download/parse cost.
+
+The timed region executes the serialized payload, creates the router and its
+small code-based route tree, calls the public client `hydrate` API, and hydrates
+the existing DOM with the framework's native renderer:
+
+- **React:** a separate completion component signals from its post-hydration
+ effect, after the same snapshot transition as hash-sensitive Links. The harness
+ awaits that signal and two idle React scheduler turns, then checks the expected
+ active links. The window's `performance.now()` is frozen, so React's
+ scheduler yields only to paint after commits, not after 5 ms of wall time, which CPU
+ instrumentation stretches by a runner-dependent factor. Each sample therefore
+ uses the same number of scheduler tasks. `Date.now()` is unchanged. A
+ 60-second watchdog fails a sample that never settles.
+- **Solid:** execute the native hydration bootstrap and retain the server's
+ component/key hierarchy. Wait for mount, the router's rendered event, active-link
+ effects, and two idle turns. DOM identity assertions include every workload
+ element so template fallback cannot silently replace server nodes.
+
+Solid bounds settlement to 100 turns. Ending at the hydration call or the
+first mount would miss post-hydration Link updates.
+Timer turns use `setImmediate`; scrolling is a no-op
+because this is CPU simulation rather than browser layout/paint measurement.
+
+Untimed assertions verify restored contexts and every loader row, zero client
+`beforeLoad`/loader calls, expected hrefs/active state, original DOM-node identity,
+working event handlers, and absence of hydration errors. Root unmount, pending
+task cancellation, and window disposal also run outside measurement. Diagnostic
+tests count Link renders or reactive evaluations and check they stop before the
+measured region ends; counting is disabled in the timed workload.
+
+The bench's own `beforeEach`/`afterEach` hooks prepare and dispose every
+sample outside timing, in both CodSpeed and ordinary Vitest runs. Per-phase
+setup would let later iterations reuse an already hydrated document. The
+hydration unit tests cover repeated fresh-state setup.
+
+Each scenario is included in its framework's aggregate build and CodSpeed run.
+Land the benchmark independently to establish main's baseline before comparing a
+hydration optimization. Regenerate each revision's artifacts with identical
+fixture data and dependencies; do not pin an old hydration wire format forever.
+
+## Isolated route-tree construction
+
+`scenarios/route-tree-scale` measures navigation over an existing tree, not
+construction. `scenarios/mount` includes construction but also rendering and
+loading. To isolate initialization, use the core construction benchmark:
+
+```bash
+CI=1 NX_DAEMON=false pnpm nx run @tanstack/router-core:test:unit --outputStyle=stream --skipRemoteCache -- bench tests/route-tree-construction.bench.ts --run --testNamePattern=1000.routes --reporter=json --outputFile=/tmp/route-tree-construction.json
+```
+
+It covers 100, 1,000, and 10,000 static, dynamic, nested, or mixed routes.
+The processing-only case creates fresh route objects in an untimed
+`beforeEach`, then measures `processRouteTree` and `route.init`. A separate
+case includes route-object creation. Neither case measures first interpolation
+or navigation. Remove the name filter to run all sizes. Compare identical
+benchmark sources in separate checkouts and repeat fresh processes; a cached
+router or repeatedly initialized tree is not a construction baseline.
+
+## Opt-in React Link performance suite
+
+`link-performance/` contains additional client-navigation and SSR workloads for
+focused Link work. They are **not included** in the regular client-nav/SSR
+aggregate projects or their CodSpeed build dependencies; they only run through
+the dedicated `@benchmarks/react-link-performance` targets below. Use `-t` to
+narrow a run to specific cases.
+
+```bash
+CI=1 NX_DAEMON=false pnpm nx run @benchmarks/react-link-performance:test:perf:client --outputStyle=stream --skipRemoteCache -- --run
+CI=1 NX_DAEMON=false pnpm nx run @benchmarks/react-link-performance:test:perf:ssr --outputStyle=stream --skipRemoteCache -- --run
+
+# Select a feature and save the normal Vitest JSON report.
+CI=1 NX_DAEMON=false pnpm nx run @benchmarks/react-link-performance:test:perf:client --outputStyle=stream --skipRemoteCache -- --run -t "updater|optional|splat" --reporter=json --outputFile=/tmp/link-perf.json
+```
+
+The cases cover repeated versus unique destination params, updater functions,
+relative/inherited values, search middleware chains, param stringification,
+optional and splat segments, encoding, masks, basepath/rewrites, and active
+props with structured search. These exercise different costs: cache hits and
+misses, parameter cloning, callbacks, middleware traversal, URI encoding,
+building masked/public locations, active-state comparisons, and prop merging.
+Existing preload, mount, and route-tree-scale scenarios remain responsible for
+those separate workloads.
+
+- **Client:** 200 persistent measured Links, four control Links, and eight
+ completed navigations per timed batch. The existing client harness checks
+ hrefs and active state during its untimed warm-up lap. Control navigations
+ replace the history entry, keeping history size constant. Post-measurement
+ assertions also check that the measured anchors stayed mounted.
+- **SSR:** four fresh-router requests per timed batch, each rendering 200
+ measured Links through `RouterProvider` and `renderToString`. Router creation,
+ `router.load()`, rendering, and history cleanup are included. This isolates
+ Router SSR Link work, not Start HTTP handling, dehydration, or streaming.
+ HTML assertions run outside the timed batch.
+- Both use the same code-based workload definitions and production JSX/library
+ builds. The regular Vitest entry points use at least 100 warm-up iterations,
+ one second of warm-up time, and five-second measurement windows. The client
+ and server bundles assert their resolved `isServer` environment. React and
+ React DOM remain external so comparisons can share the same renderer runtime.
+ These bundles are Node-hosted (jsdom for client mode), not browser deployments.
+
+Run the gate tests and typecheck separately:
+
+```bash
+CI=1 NX_DAEMON=false pnpm nx run @benchmarks/react-link-performance:test:unit --outputStyle=stream --skipRemoteCache
+CI=1 NX_DAEMON=false pnpm nx run @benchmarks/react-link-performance:test:types --outputStyle=stream --skipRemoteCache
+```
+
+For before/after comparisons, use identical benchmark files and dependencies
+on both refs, build each ref through its Nx targets, and alternate fresh
+Vitest processes. Report the actual refs, per-case means and relative margins
+of error; rerun noisy or borderline results with `-t` rather than interpreting
+a small difference as a proven speedup. Client and SSR times have different
+batch units and should not be compared directly.
+
+### Stable paired comparisons
+
+For regression decisions, prefer the paired runner over a whole-file Vitest
+run. It starts a fresh process for every case and repetition, avoiding JIT
+feedback from earlier cases. Inside each process, both revisions share the
+same production React installation but have separate router/app modules and
+router instances. Initialization order alternates between repetitions.
+Built snapshots are staged under `node_modules/.cache` so the TypeScript
+harness loader does not transpile their emitted JavaScript a second time.
+
+```bash
+# Build the baseline using these same benchmark sources in its own checkout.
+# --baseline points to that checkout's link-performance/dist directory.
+pnpm nx run @benchmarks/react-link-performance:test:perf:stable -- \
+ --baseline /path/to/baseline/benchmarks/client-nav/link-performance/dist \
+ --outputJson /tmp/paired-links.json
+
+# Narrow a comparison, or increase independent process repetitions.
+pnpm nx run @benchmarks/react-link-performance:test:perf:stable -- \
+ --baseline /path/to/baseline/benchmarks/client-nav/link-performance/dist \
+ --mode ssr -t "middleware|unique-params" --repeats 6 \
+ --outputJson /tmp/paired-links-ssr.json
+```
+
+The runner requires Node with `process.threadCpuUsage` (Node 24 works).
+It fixes V8 random/hash seeds, warms each variant for at least two seconds
+and 100 batches, then alternates ABBA/BAAB blocks calibrated to roughly 500 ms.
+Both variants do exactly the same number of batches per block. It records
+main-thread CPU time, wall time, and whole-process CPU time; GC during
+measurement is not disabled or discarded.
+
+The default is four independent process repetitions. Reported 95% intervals
+use their paired log-ratios, not the many correlated batches as independent
+samples. A faster/slower verdict requires CPU and wall intervals to agree.
+Intervals overlapping zero or disagreeing metrics are inconclusive; narrow
+intervals entirely inside +/-2% are reported separately.
+
+An A/A calibration uses the current `dist` directory as `--baseline`. Its
+intervals should contain zero before trusting similarly sized A/B differences.
+Shared-machine contention can still make small changes unresolved. Do not
+interpret a point estimate alone, or an inconclusive result, as proof that
+a workload is unchanged.
diff --git a/benchmarks/client-nav/link-performance/cases.ts b/benchmarks/client-nav/link-performance/cases.ts
new file mode 100644
index 0000000000..a25eac563b
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/cases.ts
@@ -0,0 +1,360 @@
+export const LINK_CASES = [
+ {
+ id: 'shared-params',
+ label: 'Shared string params',
+ description: '200 persistent Links reuse 40 string parameter values.',
+ },
+ {
+ id: 'unique-params',
+ label: 'Unique string params',
+ description: '200 distinct parameter values exceed the 128-result cache.',
+ },
+ {
+ id: 'param-updaters',
+ label: 'Parameter updaters',
+ description: 'Parameter functions derive destinations from current params.',
+ },
+ {
+ id: 'location-updaters',
+ label: 'Search, hash and state updaters',
+ description:
+ 'Functions derive search, hash and history state from the source.',
+ },
+ {
+ id: 'relative',
+ label: 'Relative targets',
+ description: 'Parent and child targets inherit current params and search.',
+ },
+ {
+ id: 'middleware',
+ label: 'Search middleware chain',
+ description:
+ 'Retain a tenant, strip a default page and normalize a filter.',
+ },
+ {
+ id: 'numeric-params',
+ label: 'Numeric params',
+ description: 'Parse numbers, update them numerically and stringify them.',
+ },
+ {
+ id: 'optional-params',
+ label: 'Optional segments',
+ description: 'Set, inherit and explicitly clear an optional path segment.',
+ },
+ {
+ id: 'splats',
+ label: 'Splat params',
+ description: 'Empty, multi-segment and encoded splat values.',
+ },
+ {
+ id: 'encoding',
+ label: 'Allowed path characters',
+ description: 'Preserve allowed @, : and + while encoding other characters.',
+ },
+ {
+ id: 'masks',
+ label: 'Explicit route masks',
+ description:
+ 'Build a different public path and search for each destination.',
+ },
+ {
+ id: 'rewrites',
+ label: 'Basepath and rewrites',
+ description: 'Compose /app with input/output locale path rewrites.',
+ },
+ {
+ id: 'active',
+ label: 'Active props and structured search',
+ description:
+ 'Exact, fuzzy and search matching with props and render children.',
+ },
+] as const
+
+export type LinkCaseId = (typeof LINK_CASES)[number]['id']
+
+export const LINK_COUNT = 200
+export const NAVIGATION_STATES = [1, 2, 3, 0] as const
+export const LOCALES = ['en', 'fr', 'de', 'es'] as const
+
+export interface Filter {
+ tag: string
+ flags: { open: boolean }
+ tags: Array
+}
+
+export interface LinkSearch {
+ page?: number
+ tenant?: string
+ filter?: Filter
+}
+
+export function sourceFilter(index: number): Filter {
+ return {
+ tag: `group-${index}`,
+ flags: { open: index % 2 === 0 },
+ tags: ['links', `state-${index}`],
+ }
+}
+
+export function sourceSearch(
+ caseId: LinkCaseId,
+ stateIndex: number,
+): Partial {
+ switch (caseId) {
+ case 'location-updaters':
+ case 'relative':
+ case 'middleware':
+ case 'active':
+ return {
+ page: stateIndex + 1,
+ tenant: `tenant-${stateIndex}`,
+ filter: sourceFilter(stateIndex),
+ }
+ case 'rewrites':
+ return { tenant: LOCALES[stateIndex] }
+ default:
+ return {}
+ }
+}
+
+export function optionalCategory(stateIndex: number) {
+ return stateIndex % 2 === 0 ? `category-${stateIndex}` : undefined
+}
+
+export function splatValue(index: number) {
+ switch (index % 4) {
+ case 0:
+ return ''
+ case 1:
+ return `folder/sub/file-${index % 40}`
+ case 2:
+ return 'a b/100%/caf\u00e9?#'
+ default:
+ return 'literal%2F/\u{1f680}'
+ }
+}
+
+export function encodedValue(index: number) {
+ return `user-${index % 40}@mail.test:tag+value /?#% caf\u00e9`
+}
+
+function url(pathname: string, search: Partial = {}, hash = '') {
+ const result = new URL(pathname, 'http://localhost')
+ for (const [key, value] of Object.entries(
+ search,
+ )) {
+ if (value !== undefined) {
+ result.searchParams.set(
+ key,
+ typeof value === 'object' ? JSON.stringify(value) : String(value),
+ )
+ }
+ }
+ result.hash = hash
+ return result.pathname + result.search + result.hash
+}
+
+function sourcePath(caseId: LinkCaseId, stateIndex: number) {
+ switch (caseId) {
+ case 'relative':
+ return `/teams/team-${stateIndex}/item-${stateIndex}`
+ case 'numeric-params':
+ return `/numbers/${stateIndex}`
+ case 'optional-params': {
+ const category = optionalCategory(stateIndex)
+ return `/optional/${category ? `${category}/` : ''}item-${stateIndex}`
+ }
+ case 'splats':
+ return `/files/source/state-${stateIndex}`
+ case 'encoding':
+ return `/encoded/source-${stateIndex}`
+ case 'active':
+ return `/items/item-${stateIndex}/details`
+ default:
+ return `/items/item-${stateIndex}`
+ }
+}
+
+export function getSourceUrl(caseId: LinkCaseId, stateIndex: number): string {
+ if (!Number.isInteger(stateIndex) || stateIndex < 0 || stateIndex > 3) {
+ throw new Error(`Invalid Link performance state: ${stateIndex}`)
+ }
+ const pathname = sourcePath(caseId, stateIndex)
+ if (caseId === 'rewrites') {
+ return `/app/${LOCALES[stateIndex]}${pathname}`
+ }
+ return url(
+ pathname,
+ sourceSearch(caseId, stateIndex),
+ caseId === 'location-updaters' ? `source-${stateIndex}` : '',
+ )
+}
+
+// These expectations use fixture values and platform encoding, not router APIs.
+function expectedHref(caseId: LinkCaseId, stateIndex: number, index: number) {
+ const itemId = `item-${index % 40}`
+ switch (caseId) {
+ case 'shared-params':
+ return `/items/${itemId}`
+ case 'unique-params':
+ return `/items/item-${index}`
+ case 'param-updaters':
+ return `/items/item-${stateIndex}-related-${index % 40}`
+ case 'location-updaters':
+ return url(
+ `/items/item-${stateIndex}`,
+ {
+ ...sourceSearch(caseId, stateIndex),
+ page: stateIndex + 2 + (index % 5),
+ },
+ `source-${stateIndex}-link-${index % 5}`,
+ )
+ case 'relative':
+ return url(
+ index % 2 === 0
+ ? `/teams/team-${stateIndex}`
+ : `/teams/team-${stateIndex}/item-${stateIndex}/details`,
+ sourceSearch(caseId, stateIndex),
+ )
+ case 'middleware':
+ return url(`/filtered/${itemId}`, {
+ tenant: `tenant-${stateIndex}`,
+ page: index % 2 === 0 ? undefined : 2,
+ filter: { ...sourceFilter(index % 4), tag: `LABEL-${index % 40}` },
+ })
+ case 'numeric-params':
+ return `/numbers/${stateIndex + (index % 40)}`
+ case 'optional-params': {
+ const category =
+ index % 3 === 0
+ ? 'fixed'
+ : index % 3 === 1
+ ? optionalCategory(stateIndex)
+ : undefined
+ return `/optional/${category ? `${category}/` : ''}${itemId}`
+ }
+ case 'splats': {
+ const value = splatValue(index)
+ return `/files${value ? `/${value.split('/').map(encodeURIComponent).join('/')}` : ''}`
+ }
+ case 'encoding': {
+ const value = encodeURIComponent(encodedValue(index))
+ .replaceAll('%40', '@')
+ .replaceAll('%3A', ':')
+ .replaceAll('%2B', '+')
+ return `/encoded/${value}`
+ }
+ case 'masks':
+ return url(`/public/display-${index % 40}`, {
+ tenant: `mask-${index % 4}`,
+ })
+ case 'rewrites':
+ return url(`/app/${LOCALES[index % 4]}/items/${itemId}`, {
+ page: (index % 3) + 1,
+ })
+ case 'active': {
+ const item = Math.floor(index / 5)
+ const variant = index % 5
+ const search =
+ variant < 3
+ ? { filter: sourceFilter(item % 4) }
+ : {
+ ...sourceSearch('active', item % 4),
+ ...(variant === 4 ? { filter: undefined } : {}),
+ }
+ return url(`/items/item-${item}${variant < 2 ? '' : '/details'}`, search)
+ }
+ }
+}
+
+function assertUrl(
+ actualHref: string | null,
+ expectedHref: string,
+ label: string,
+) {
+ if (actualHref === null) {
+ throw new Error(`${label}: missing href`)
+ }
+ const actual = new URL(actualHref, 'http://localhost')
+ const expected = new URL(expectedHref, 'http://localhost')
+ // Query ordering and the platform's '+' versus '%20' are immaterial here.
+ const query = (value: URL) =>
+ JSON.stringify([...value.searchParams.entries()].sort())
+ if (
+ actual.origin !== expected.origin ||
+ actual.pathname !== expected.pathname ||
+ actual.hash !== expected.hash ||
+ query(actual) !== query(expected)
+ ) {
+ throw new Error(
+ `${label}: expected ${expectedHref}, received ${actualHref}`,
+ )
+ }
+}
+
+export function assertScenario(
+ caseId: LinkCaseId,
+ stateIndex: number,
+ root: ParentNode,
+): void {
+ const source = root.querySelector('[data-testid="source-path"]')
+ if (source?.textContent !== sourcePath(caseId, stateIndex)) {
+ throw new Error(
+ `${caseId}/${stateIndex}: unexpected source path ${source?.textContent}`,
+ )
+ }
+ const links = root.querySelectorAll('a[data-perf-link]')
+ if (links.length !== LINK_COUNT) {
+ throw new Error(
+ `${caseId}: expected ${LINK_COUNT} Links, got ${links.length}`,
+ )
+ }
+ for (const [index, link] of links.entries()) {
+ const label = `${caseId}/${stateIndex}/link-${index}`
+ if (link.getAttribute('data-perf-link') !== String(index)) {
+ throw new Error(`${label}: unexpected Link order`)
+ }
+ assertUrl(
+ link.getAttribute('href'),
+ expectedHref(caseId, stateIndex, index),
+ label,
+ )
+ let active: boolean | undefined
+ if (caseId === 'shared-params') {
+ active = index % 40 === stateIndex
+ } else if (caseId === 'unique-params') {
+ active = index === stateIndex
+ } else if (caseId === 'active') {
+ active =
+ Math.floor(index / 5) === stateIndex && [0, 2, 3].includes(index % 5)
+ if (
+ link.textContent !== `${index}:${active ? 'active' : 'inactive'}` ||
+ link.getAttribute('title') !== (active ? 'active' : 'inactive') ||
+ !link.classList.contains(active ? 'perf-active' : 'perf-inactive') ||
+ link.style.color !== (active ? 'green' : 'gray') ||
+ link.style.opacity !== '0.8'
+ ) {
+ throw new Error(
+ `${label}: active props or render children are incorrect`,
+ )
+ }
+ }
+ if (
+ active !== undefined &&
+ (link.getAttribute('data-status') === 'active') !== active
+ ) {
+ throw new Error(`${label}: expected active=${active}`)
+ }
+ }
+ for (let state = 0; state < 4; state++) {
+ const control = root.querySelector(`[data-testid="go-state-${state}"]`)
+ if (!control || control.hasAttribute('data-perf-link')) {
+ throw new Error(`${caseId}: missing or measured control Link ${state}`)
+ }
+ assertUrl(
+ control.getAttribute('href'),
+ getSourceUrl(caseId, state),
+ `${caseId}/control-${state}`,
+ )
+ }
+}
diff --git a/benchmarks/client-nav/link-performance/client.bench.ts b/benchmarks/client-nav/link-performance/client.bench.ts
new file mode 100644
index 0000000000..f819fab52b
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/client.bench.ts
@@ -0,0 +1,30 @@
+import { test } from 'vitest'
+import { benchLifecycle } from '../../cpu-simulation'
+import { LINK_CASES } from './cases'
+import { createClientScenario, samplingOptions } from './scenario'
+import type * as App from './src/client'
+
+const appModulePath = './dist/client/app.js'
+const app: typeof App = await import(/* @vite-ignore */ appModulePath)
+if (app.serverEnvironment !== false) {
+ throw new Error('Link client benchmarks must use the production client build')
+}
+
+for (const { id, label } of LINK_CASES) {
+ test(label, async ({ bench }) => {
+ const scenario = createClientScenario(app, id)
+ function finish() {
+ try {
+ scenario.check()
+ } finally {
+ scenario.teardown()
+ }
+ }
+
+ await bench(
+ `client Links: ${id}`,
+ benchLifecycle({ before: scenario.setup, after: finish }),
+ scenario.batch,
+ ).run(samplingOptions)
+ })
+}
diff --git a/benchmarks/client-nav/link-performance/config.test.ts b/benchmarks/client-nav/link-performance/config.test.ts
new file mode 100644
index 0000000000..1a468a3169
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/config.test.ts
@@ -0,0 +1,42 @@
+import { afterEach, describe, expect, test, vi } from 'vitest'
+import { createLinkPerformanceConfig } from './config'
+
+afterEach(() => vi.unstubAllEnvs())
+
+describe.each(['client', 'ssr'] as const)('%s configuration', (target) => {
+ test('discovers only the requested suite', () => {
+ const config = createLinkPerformanceConfig(target)
+ expect(config.test?.benchmark?.include).toEqual([`${target}.bench.ts`])
+ })
+
+ test('builds production code for the correct environment', () => {
+ const config = createLinkPerformanceConfig(target)
+ expect(config.define?.['process.env.NODE_ENV']).toBe('"production"')
+ expect(config.resolve?.conditions).toContain(
+ target === 'ssr' ? 'node' : 'browser',
+ )
+ expect(config.build?.ssr).toBe(target === 'ssr')
+ expect(config.build?.outDir).toBe(`./dist/${target}`)
+ expect(config.build?.rolldownOptions?.platform).toBe('node')
+ expect(config.build?.rolldownOptions?.external).toEqual([
+ 'node:module',
+ 'module',
+ /^react(?:\/|$)/,
+ /^react-dom(?:\/|$)/,
+ ])
+ })
+
+ test('does not retransform built bundles in the test environment', () => {
+ vi.stubEnv('VITEST', 'true')
+ const config = createLinkPerformanceConfig(target)
+ expect(config.ssr?.noExternal).toBeUndefined()
+ expect(config.test?.server?.deps?.external).toEqual([
+ /\/link-performance\/dist\//,
+ ])
+ })
+
+ test('bundles router dependencies when building app snapshots', () => {
+ vi.stubEnv('VITEST', undefined)
+ expect(createLinkPerformanceConfig(target).ssr?.noExternal).toBe(true)
+ })
+})
diff --git a/benchmarks/client-nav/link-performance/config.ts b/benchmarks/client-nav/link-performance/config.ts
new file mode 100644
index 0000000000..416b027057
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/config.ts
@@ -0,0 +1,69 @@
+import { fileURLToPath } from 'node:url'
+import react from '@vitejs/plugin-react'
+import codspeedPlugin from '@codspeed/vitest-plugin'
+import type { UserConfig } from 'vite'
+
+const root = fileURLToPath(new URL('.', import.meta.url))
+
+export function createLinkPerformanceConfig(
+ target: 'client' | 'ssr',
+): UserConfig {
+ const server = target === 'ssr'
+
+ return {
+ root,
+ define: {
+ 'process.env.NODE_ENV': JSON.stringify('production'),
+ },
+ plugins: [
+ !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&
+ codspeedPlugin(),
+ react(),
+ ],
+ resolve: {
+ conditions: [server ? 'node' : 'browser', 'production'],
+ },
+ ssr: {
+ noExternal: process.env.VITEST ? undefined : true,
+ resolve: {
+ conditions: ['node', 'production'],
+ },
+ },
+ build: {
+ outDir: `./dist/${target}`,
+ emptyOutDir: true,
+ minify: false,
+ ssr: server,
+ lib: {
+ entry: `${root}src/${target}.tsx`,
+ formats: ['es'],
+ fileName: 'app',
+ },
+ rolldownOptions: {
+ platform: 'node',
+ external: [
+ 'node:module',
+ 'module',
+ /^react(?:\/|$)/,
+ /^react-dom(?:\/|$)/,
+ ],
+ output: { entryFileNames: 'app.js' },
+ },
+ },
+ test: {
+ name: `react-link-performance-${target}`,
+ watch: false,
+ environment: server ? 'node' : 'jsdom',
+ setupFiles: server ? [] : ['../vitest.setup.ts'],
+ server: {
+ deps: {
+ external: [/\/link-performance\/dist\//],
+ },
+ },
+ include: [],
+ benchmark: {
+ include: [`${target}.bench.ts`],
+ },
+ },
+ }
+}
diff --git a/benchmarks/client-nav/link-performance/project.json b/benchmarks/client-nav/link-performance/project.json
new file mode 100644
index 0000000000..fd1751c081
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/project.json
@@ -0,0 +1,103 @@
+{
+ "name": "@benchmarks/react-link-performance",
+ "projectType": "application",
+ "tags": ["optional-benchmark"],
+ "targets": {
+ "build:client": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": [
+ {
+ "projects": ["@tanstack/react-router"],
+ "target": "build"
+ }
+ ],
+ "options": {
+ "command": "NODE_ENV=production vite build --config ./link-performance/vite.client.config.ts",
+ "cwd": "benchmarks/client-nav"
+ }
+ },
+ "build:ssr": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": [
+ {
+ "projects": ["@tanstack/react-router"],
+ "target": "build"
+ }
+ ],
+ "options": {
+ "command": "NODE_ENV=production vite build --config ./link-performance/vite.ssr.config.ts",
+ "cwd": "benchmarks/client-nav"
+ }
+ },
+ "test:perf:client": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": ["build:client"],
+ "options": {
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./link-performance/vite.client.config.ts",
+ "cwd": "benchmarks/client-nav"
+ }
+ },
+ "test:perf:ssr": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": ["build:ssr"],
+ "options": {
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./link-performance/vite.ssr.config.ts",
+ "cwd": "benchmarks/client-nav"
+ }
+ },
+ "test:perf:stable": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": ["build:client", "build:ssr"],
+ "options": {
+ "command": "NODE_ENV=production node --import=@swc-node/register/esm-register benchmarks/client-nav/link-performance/stable-runner.ts"
+ }
+ },
+ "test:unit": {
+ "executor": "nx:run-commands",
+ "inputs": [
+ "...",
+ "{workspaceRoot}/benchmarks/client-nav/scenarios/harness.ts",
+ "{workspaceRoot}/benchmarks/client-nav/scenarios/links/shared.ts",
+ "{workspaceRoot}/benchmarks/client-nav/setup-helpers.ts",
+ "{workspaceRoot}/benchmarks/client-nav/tsconfig.json"
+ ],
+ "dependsOn": [
+ {
+ "projects": ["@tanstack/history"],
+ "target": "build"
+ }
+ ],
+ "options": {
+ "command": "vitest run --config ./link-performance/vitest.config.ts",
+ "cwd": "benchmarks/client-nav"
+ }
+ },
+ "test:types": {
+ "executor": "nx:run-commands",
+ "inputs": [
+ "...",
+ "{workspaceRoot}/benchmarks/client-nav/jsdom.ts",
+ "{workspaceRoot}/benchmarks/client-nav/scenarios/harness.ts",
+ "{workspaceRoot}/benchmarks/client-nav/scenarios/links/shared.ts",
+ "{workspaceRoot}/benchmarks/client-nav/setup-helpers.ts",
+ "{workspaceRoot}/benchmarks/client-nav/tsconfig.json",
+ "{workspaceRoot}/benchmarks/client-nav/vitest.setup.ts"
+ ],
+ "dependsOn": [
+ {
+ "projects": ["@tanstack/react-router"],
+ "target": "build"
+ }
+ ],
+ "options": {
+ "command": "tsc -p ./link-performance/tsconfig.json --noEmit",
+ "cwd": "benchmarks/client-nav"
+ }
+ }
+ }
+}
diff --git a/benchmarks/client-nav/link-performance/scenario.ts b/benchmarks/client-nav/link-performance/scenario.ts
new file mode 100644
index 0000000000..f1a3fb6df7
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/scenario.ts
@@ -0,0 +1,114 @@
+import { JSDOM } from 'jsdom'
+import { createScenarioSetup } from '../scenarios/harness'
+import { ticksPerIteration } from '../scenarios/links/shared'
+import { NAVIGATION_STATES, assertScenario, getSourceUrl } from './cases'
+import type { LinkCaseId } from './cases'
+import type * as ClientApp from './src/client'
+import type * as SsrApp from './src/ssr'
+
+export interface LinkScenario {
+ setup: () => Promise
+ batch: () => Promise
+ check: () => void
+ teardown: () => void
+}
+
+export const samplingOptions = {
+ warmupIterations: 100,
+ warmupTime: 1_000,
+ time: 5_000,
+ throws: true,
+}
+
+export function createClientScenario(
+ app: typeof ClientApp,
+ id: LinkCaseId,
+): LinkScenario {
+ let mounted: ReturnType | undefined
+ let container: HTMLElement | undefined
+ let anchors: Array = []
+ const test = createScenarioSetup({
+ frameworkLabel: 'React',
+ mount: (element, history) => {
+ container = element
+ mounted = app.mountTestApp(element, history, id)
+ return mounted
+ },
+ initialUrl: getSourceUrl(id, 0),
+ steps: NAVIGATION_STATES.map((state) => `go-state-${state}`),
+ assertAfterStep: (index, element) => {
+ assertScenario(id, NAVIGATION_STATES[index]!, element)
+ if (!mounted) {
+ throw new Error('Link benchmark app was not mounted')
+ }
+ mounted.assertStateUpdates()
+ },
+ })
+
+ return {
+ async setup() {
+ await test.before()
+ if (!container) {
+ throw new Error('Link benchmark container was not created')
+ }
+ anchors = [...container.querySelectorAll('a[data-perf-link]')]
+ },
+ async batch() {
+ for (let index = 0; index < ticksPerIteration; index++) {
+ await test.tick()
+ }
+ await test.finishBatch()
+ },
+ check() {
+ if (!container || !mounted) {
+ throw new Error('Link benchmark app was not mounted')
+ }
+ assertScenario(id, 0, container)
+ mounted.assertStateUpdates()
+ if (mounted.router.history.length !== 1) {
+ throw new Error('Link benchmark history must remain bounded')
+ }
+ const current = container.querySelectorAll('a[data-perf-link]')
+ if (anchors.some((anchor, index) => current[index] !== anchor)) {
+ throw new Error('Measured Links must stay mounted across navigations')
+ }
+ },
+ teardown: test.after,
+ }
+}
+
+export function createSsrScenario(
+ app: typeof SsrApp,
+ id: LinkCaseId,
+): LinkScenario {
+ let html = ''
+ let state = 0
+ function check() {
+ const dom = new JSDOM(html)
+ try {
+ assertScenario(id, state, dom.window.document)
+ } finally {
+ dom.window.close()
+ }
+ }
+
+ return {
+ async setup() {
+ for (const nextState of NAVIGATION_STATES) {
+ state = nextState
+ html = await app.renderScenario(id, state, true)
+ check()
+ }
+ },
+ async batch() {
+ for (const nextState of NAVIGATION_STATES) {
+ state = nextState
+ html = await app.renderScenario(id, state)
+ }
+ },
+ check,
+ teardown() {
+ html = ''
+ },
+ }
+}
diff --git a/benchmarks/client-nav/link-performance/src/client.tsx b/benchmarks/client-nav/link-performance/src/client.tsx
new file mode 100644
index 0000000000..a187ee8c15
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/src/client.tsx
@@ -0,0 +1,29 @@
+import { RouterProvider } from '@tanstack/react-router'
+import { isServer } from '@tanstack/router-core/isServer'
+import { createRoot } from 'react-dom/client'
+import { assertStateUpdates, createLinkRouter } from './workload'
+import type { LinkRouter } from './workload'
+import type { RouterHistory } from '@tanstack/history'
+import type { LinkCaseId } from '../cases'
+
+export const serverEnvironment: boolean | undefined = isServer
+
+export function mountTestApp(
+ container: HTMLElement,
+ history: RouterHistory,
+ caseId: LinkCaseId,
+): {
+ router: LinkRouter
+ unmount: () => void
+ assertStateUpdates: () => void
+} {
+ const router = createLinkRouter(caseId, history, false)
+ const root = createRoot(container)
+ root.render( )
+
+ return {
+ router,
+ unmount: () => root.unmount(),
+ assertStateUpdates: () => assertStateUpdates(router),
+ }
+}
diff --git a/benchmarks/client-nav/link-performance/src/ssr.tsx b/benchmarks/client-nav/link-performance/src/ssr.tsx
new file mode 100644
index 0000000000..491191b1f9
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/src/ssr.tsx
@@ -0,0 +1,29 @@
+import { RouterProvider, createMemoryHistory } from '@tanstack/react-router'
+import { isServer } from '@tanstack/router-core/isServer'
+import { renderToString } from 'react-dom/server'
+import { getSourceUrl } from '../cases'
+import { assertStateUpdates, createLinkRouter } from './workload'
+import type { LinkCaseId } from '../cases'
+
+export const serverEnvironment: boolean | undefined = isServer
+
+export async function renderScenario(
+ caseId: LinkCaseId,
+ stateIndex: number,
+ verify = false,
+) {
+ const history = createMemoryHistory({
+ initialEntries: [getSourceUrl(caseId, stateIndex)],
+ })
+ const router = createLinkRouter(caseId, history, true)
+ try {
+ await router.load()
+ const html = renderToString( )
+ if (verify) {
+ assertStateUpdates(router)
+ }
+ return html
+ } finally {
+ history.destroy()
+ }
+}
diff --git a/benchmarks/client-nav/link-performance/src/workload.tsx b/benchmarks/client-nav/link-performance/src/workload.tsx
new file mode 100644
index 0000000000..8315b85b8b
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/src/workload.tsx
@@ -0,0 +1,506 @@
+import {
+ Link,
+ Outlet,
+ createRootRouteWithContext,
+ createRoute,
+ createRouter,
+ linkOptions,
+ retainSearchParams,
+ stripSearchParams,
+ useLocation,
+} from '@tanstack/react-router'
+import {
+ LINK_COUNT,
+ LOCALES,
+ encodedValue,
+ optionalCategory,
+ sourceFilter,
+ sourceSearch,
+ splatValue,
+} from '../cases'
+import type { RouterHistory } from '@tanstack/history'
+import type { SearchSchemaInput } from '@tanstack/react-router'
+import type { Filter, LinkCaseId, LinkSearch } from '../cases'
+
+interface StateUpdates {
+ calls: number
+ verifiedCalls: number
+ input: number
+ output: number
+ offset: number
+}
+
+interface WorkloadContext {
+ caseId: LinkCaseId
+ stateUpdates: StateUpdates
+}
+
+function isFilter(value: unknown): value is Filter {
+ return (
+ typeof value === 'object' &&
+ value !== null &&
+ 'tag' in value &&
+ typeof value.tag === 'string' &&
+ 'flags' in value &&
+ typeof value.flags === 'object' &&
+ value.flags !== null &&
+ 'open' in value.flags &&
+ typeof value.flags.open === 'boolean' &&
+ 'tags' in value &&
+ Array.isArray(value.tags) &&
+ value.tags.every((tag: unknown) => typeof tag === 'string')
+ )
+}
+
+const rootRoute = createRootRouteWithContext()({
+ validateSearch: (
+ search: Record & SearchSchemaInput,
+ ): LinkSearch => ({
+ page: typeof search.page === 'number' ? search.page : undefined,
+ tenant: typeof search.tenant === 'string' ? search.tenant : undefined,
+ filter: isFilter(search.filter) ? search.filter : undefined,
+ }),
+ component: RootLayout,
+})
+
+const itemsRoute = createRoute({
+ getParentRoute: () => rootRoute,
+ path: 'items/$itemId',
+})
+const detailsRoute = createRoute({
+ getParentRoute: () => itemsRoute,
+ path: 'details',
+})
+const teamRoute = createRoute({
+ getParentRoute: () => rootRoute,
+ path: 'teams/$teamId',
+})
+const teamItemRoute = createRoute({
+ getParentRoute: () => teamRoute,
+ path: '$itemId',
+})
+const teamDetailsRoute = createRoute({
+ getParentRoute: () => teamItemRoute,
+ path: 'details',
+})
+const filteredRoute = createRoute({
+ getParentRoute: () => rootRoute,
+ path: 'filtered/$itemId',
+ search: {
+ middlewares: [
+ retainSearchParams(['tenant']),
+ stripSearchParams({ page: 1 }),
+ ({ search, next }) => {
+ const result = next(search)
+ return {
+ ...result,
+ filter: result.filter
+ ? { ...result.filter, tag: result.filter.tag.trim().toUpperCase() }
+ : undefined,
+ }
+ },
+ ],
+ },
+})
+const numericRoute = createRoute({
+ getParentRoute: () => rootRoute,
+ path: 'numbers/$number',
+ params: {
+ parse: ({ number }) => {
+ const value = Number(number)
+ if (!Number.isFinite(value)) {
+ throw new Error(`Invalid number: ${number}`)
+ }
+ return { number: value }
+ },
+ stringify: ({ number }) => ({ number: String(number) }),
+ },
+})
+const optionalRoute = createRoute({
+ getParentRoute: () => rootRoute,
+ path: 'optional/{-$category}/$itemId',
+})
+const splatRoute = createRoute({
+ getParentRoute: () => rootRoute,
+ path: 'files/$',
+})
+const encodedRoute = createRoute({
+ getParentRoute: () => rootRoute,
+ path: 'encoded/$value',
+})
+const publicRoute = createRoute({
+ getParentRoute: () => rootRoute,
+ path: 'public/$itemId',
+})
+
+const routeTree = rootRoute.addChildren([
+ itemsRoute.addChildren([detailsRoute]),
+ teamRoute.addChildren([teamItemRoute.addChildren([teamDetailsRoute])]),
+ filteredRoute,
+ numericRoute,
+ optionalRoute,
+ splatRoute,
+ encodedRoute,
+ publicRoute,
+])
+
+const localeRewrite = {
+ input: ({ url }: { url: URL }) => {
+ const match = /^\/(en|fr|de|es)(\/.*)$/.exec(url.pathname)
+ if (match) {
+ url.pathname = match[2]!
+ url.searchParams.set('tenant', match[1]!)
+ }
+ return url
+ },
+ output: ({ url }: { url: URL }) => {
+ const locale = url.searchParams.get('tenant')
+ if (locale) {
+ url.searchParams.delete('tenant')
+ url.pathname = `/${locale}${url.pathname}`
+ }
+ return url
+ },
+}
+
+export function createLinkRouter(
+ caseId: LinkCaseId,
+ history: RouterHistory,
+ isServer: boolean,
+) {
+ const context: WorkloadContext = {
+ caseId,
+ stateUpdates: {
+ calls: 0,
+ verifiedCalls: 0,
+ input: 0,
+ output: 0,
+ offset: 0,
+ },
+ }
+ return createRouter({
+ routeTree,
+ history,
+ isServer,
+ context,
+ scrollRestoration: false,
+ defaultPreload: false,
+ trailingSlash: 'never',
+ pathParamsAllowedCharacters:
+ caseId === 'encoding' ? ['@', ':', '+'] : undefined,
+ ...(caseId === 'rewrites'
+ ? { basepath: '/app', rewrite: localeRewrite }
+ : {}),
+ })
+}
+
+export type LinkRouter = ReturnType
+
+declare module '@tanstack/react-router' {
+ interface Register {
+ router: LinkRouter
+ }
+}
+
+declare module '@tanstack/history' {
+ interface HistoryState {
+ linkPerfState?: number
+ }
+}
+
+// Call alongside DOM assertions, outside the timed loop, after each sample.
+export function assertStateUpdates(router: LinkRouter): void {
+ const { caseId, stateUpdates } = router.options.context
+ if (caseId !== 'location-updaters') {
+ return
+ }
+ const input = router.state.location.state.linkPerfState ?? 0
+ if (
+ stateUpdates.calls - stateUpdates.verifiedCalls < LINK_COUNT ||
+ stateUpdates.input !== input ||
+ stateUpdates.output !== input + stateUpdates.offset ||
+ stateUpdates.offset < 1 ||
+ stateUpdates.offset > 40
+ ) {
+ throw new Error(
+ 'Link history-state updaters did not run with current state',
+ )
+ }
+ stateUpdates.verifiedCalls = stateUpdates.calls
+}
+
+function sourceOptions(caseId: LinkCaseId, stateIndex: number) {
+ const itemId = `item-${stateIndex}`
+ const common = {
+ search: sourceSearch(caseId, stateIndex),
+ hash: caseId === 'location-updaters' ? `source-${stateIndex}` : '',
+ state: { linkPerfState: stateIndex + 10 },
+ }
+ switch (caseId) {
+ case 'relative':
+ return linkOptions({
+ ...common,
+ to: '/teams/$teamId/$itemId',
+ params: { teamId: `team-${stateIndex}`, itemId },
+ })
+ case 'numeric-params':
+ return linkOptions({
+ ...common,
+ to: '/numbers/$number',
+ params: { number: stateIndex },
+ })
+ case 'optional-params':
+ return linkOptions({
+ ...common,
+ to: '/optional/{-$category}/$itemId',
+ params: { category: optionalCategory(stateIndex), itemId },
+ })
+ case 'splats':
+ return linkOptions({
+ ...common,
+ to: '/files/$',
+ params: { _splat: `source/state-${stateIndex}` },
+ })
+ case 'encoding':
+ return linkOptions({
+ ...common,
+ to: '/encoded/$value',
+ params: { value: `source-${stateIndex}` },
+ })
+ case 'active':
+ return linkOptions({
+ ...common,
+ to: '/items/$itemId/details',
+ params: { itemId },
+ })
+ default:
+ return linkOptions({
+ ...common,
+ to: '/items/$itemId',
+ params: { itemId },
+ })
+ }
+}
+
+const indexes = Array.from({ length: LINK_COUNT }, (_, index) => index)
+const controls = [0, 1, 2, 3] as const
+
+function SourcePath() {
+ const pathname = useLocation({ select: (location) => location.pathname })
+ return {pathname}
+}
+
+function RootLayout() {
+ const context = rootRoute.useRouteContext()
+ return (
+ <>
+
+ {controls.map((stateIndex) => (
+
+ State {stateIndex}
+
+ ))}
+
+
+
+ {indexes.map((index) => measuredLink(context, index))}
+
+
+ >
+ )
+}
+
+function measuredLink(
+ { caseId, stateUpdates }: WorkloadContext,
+ index: number,
+) {
+ const common = {
+ key: index,
+ 'data-perf-link': index,
+ preload: false,
+ children: `Link ${index}`,
+ } as const
+ const itemId = `item-${index % 40}`
+ switch (caseId) {
+ case 'shared-params':
+ case 'unique-params':
+ return (
+
+ )
+ case 'param-updaters':
+ return (
+ ({
+ itemId: `${previous.itemId}-related-${index % 40}`,
+ })}
+ />
+ )
+ case 'location-updaters':
+ return (
+ ({
+ ...previous,
+ page: (previous.page ?? 1) + 1 + (index % 5),
+ })}
+ hash={(previous) => `${previous}-link-${index % 5}`}
+ state={(previous) => {
+ const input = previous.linkPerfState ?? 0
+ const offset = (index % 40) + 1
+ const output = input + offset
+ stateUpdates.calls++
+ stateUpdates.input = input
+ stateUpdates.output = output
+ stateUpdates.offset = offset
+ return { ...previous, linkPerfState: output }
+ }}
+ />
+ )
+ case 'relative':
+ return (
+
+ )
+ case 'middleware':
+ return (
+
+ )
+ case 'numeric-params':
+ return (
+ ({ number: previous.number + (index % 40) })}
+ />
+ )
+ case 'optional-params':
+ return (
+
+ )
+ case 'splats':
+ return (
+
+ )
+ case 'encoding':
+ return (
+
+ )
+ case 'masks':
+ return (
+
+ )
+ case 'rewrites':
+ return (
+
+ )
+ case 'active': {
+ const item = Math.floor(index / 5)
+ const variant = index % 5
+ return (
+ ({
+ className: 'perf-active',
+ title: 'active',
+ style: { color: 'green' },
+ })}
+ inactiveProps={() => ({
+ className: 'perf-inactive',
+ title: 'inactive',
+ style: { color: 'gray' },
+ })}
+ >
+ {({ isActive }) => `${index}:${isActive ? 'active' : 'inactive'}`}
+
+ )
+ }
+ }
+}
diff --git a/benchmarks/client-nav/link-performance/ssr.bench.ts b/benchmarks/client-nav/link-performance/ssr.bench.ts
new file mode 100644
index 0000000000..c30084e510
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/ssr.bench.ts
@@ -0,0 +1,30 @@
+import { test } from 'vitest'
+import { benchLifecycle } from '../../cpu-simulation'
+import { LINK_CASES } from './cases'
+import { createSsrScenario, samplingOptions } from './scenario'
+import type * as App from './src/ssr'
+
+const appUrl = new URL('./dist/ssr/app.js', import.meta.url).href
+const app: typeof App = await import(/* @vite-ignore */ appUrl)
+if (app.serverEnvironment !== true) {
+ throw new Error('Link SSR benchmarks must use the production server build')
+}
+
+for (const { id, label } of LINK_CASES) {
+ test(label, async ({ bench }) => {
+ const scenario = createSsrScenario(app, id)
+ function finish() {
+ try {
+ scenario.check()
+ } finally {
+ scenario.teardown()
+ }
+ }
+
+ await bench(
+ `SSR Links: ${id}`,
+ benchLifecycle({ before: scenario.setup, after: finish }),
+ scenario.batch,
+ ).run(samplingOptions)
+ })
+}
diff --git a/benchmarks/client-nav/link-performance/stable-runner.ts b/benchmarks/client-nav/link-performance/stable-runner.ts
new file mode 100644
index 0000000000..59ccfa3cb4
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/stable-runner.ts
@@ -0,0 +1,269 @@
+import { fork } from 'node:child_process'
+import { createHash } from 'node:crypto'
+import {
+ copyFileSync,
+ mkdirSync,
+ readFileSync,
+ rmSync,
+ writeFileSync,
+} from 'node:fs'
+import { dirname, resolve } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { parseArgs } from 'node:util'
+import { LINK_CASES } from './cases'
+import { createStagingDirectory } from './staging'
+import { classify, mean, summarizeRatios } from './statistics'
+import type { LinkCaseId } from './cases'
+import type {
+ BlockSample,
+ Mode,
+ Variant,
+ WorkerRequest,
+ WorkerResponse,
+} from './worker-protocol'
+
+const projectRoot = fileURLToPath(new URL('.', import.meta.url))
+const workspaceRoot = resolve(projectRoot, '../../..')
+
+function startWorker() {
+ const child = fork(
+ fileURLToPath(new URL('./stable-worker.ts', import.meta.url)),
+ {
+ cwd: workspaceRoot,
+ env: { ...process.env, NODE_ENV: 'production' },
+ execArgv: [
+ '--import=@swc-node/register/esm-register',
+ '--random-seed=42',
+ '--hash-seed=42',
+ ],
+ stdio: ['ignore', 'ignore', 'pipe', 'ipc'],
+ },
+ )
+ let stderr = ''
+ child.stderr?.on('data', (data: Buffer) => {
+ stderr = (stderr + data.toString()).slice(-4_096)
+ })
+
+ function request(message: WorkerRequest): Promise {
+ return new Promise((resolveResponse, reject) => {
+ const timeout = setTimeout(() => {
+ finish(
+ new Error(`Sampling worker timed out: ${message.kind}\n${stderr}`),
+ )
+ }, 60_000)
+ const onExit = (code: number | null) =>
+ finish(new Error(`Sampling worker exited (${code})\n${stderr}`))
+ const onError = (error: Error) => finish(error)
+ const onMessage = (response: WorkerResponse) => {
+ if (response.kind === 'error') {
+ finish(new Error(response.message))
+ } else {
+ finish(undefined, response)
+ }
+ }
+ function finish(error?: Error, response?: WorkerResponse) {
+ clearTimeout(timeout)
+ child.off('message', onMessage)
+ child.off('error', onError)
+ child.off('exit', onExit)
+ if (error) {
+ reject(error)
+ } else if (response) {
+ resolveResponse(response)
+ }
+ }
+ child.once('message', onMessage)
+ child.once('error', onError)
+ child.once('exit', onExit)
+ child.send(message, (error) => {
+ if (error) {
+ finish(error)
+ }
+ })
+ })
+ }
+
+ return {
+ request,
+ kill: () => child.kill(),
+ }
+}
+
+async function sampleReplica(
+ mode: Mode,
+ caseId: LinkCaseId,
+ baseline: string,
+ current: string,
+ replica: number,
+) {
+ const worker = startWorker()
+ const samples: Array> = [[], []]
+ const ratios: Array<{ cpu: number; wall: number }> = []
+ try {
+ const starts: Array = []
+ // Balance module initialization and which variant finishes warming last.
+ const startupOrder: Array = replica % 2 ? [1, 0] : [0, 1]
+ for (const index of startupOrder) {
+ const ready = await worker.request({
+ kind: 'init',
+ mode,
+ caseId,
+ bundle: index === 0 ? baseline : current,
+ variant: index,
+ })
+ if (ready.kind !== 'ready') {
+ throw new Error('Expected a ready sampling worker')
+ }
+ starts[index] = ready.batchMs
+ }
+ const iterations = Math.max(1, Math.ceil(500 / Math.min(...starts)))
+ for (let round = 0; round < 2; round++) {
+ const block: Array> = [[], []]
+ const order: Array =
+ (round + replica) % 2 ? [1, 0, 0, 1] : [0, 1, 1, 0]
+ for (const index of order) {
+ const result = await worker.request({
+ kind: 'measure',
+ iterations,
+ variant: index,
+ })
+ if (result.kind !== 'sample') {
+ throw new Error('Expected a block measurement')
+ }
+ samples[index]!.push(result.sample)
+ block[index]!.push(result.sample)
+ }
+ ratios.push({
+ cpu:
+ mean(block[1]!.map((s) => s.cpuMs)) /
+ mean(block[0]!.map((s) => s.cpuMs)),
+ wall:
+ mean(block[1]!.map((s) => s.wallMs)) /
+ mean(block[0]!.map((s) => s.wallMs)),
+ })
+ }
+ const response = await worker.request({ kind: 'stop' })
+ if (response.kind !== 'stopped') {
+ throw new Error('Expected successful post-measurement assertions')
+ }
+ return {
+ iterations,
+ baseline: samples[0]!,
+ current: samples[1]!,
+ cpuRatio: Math.exp(mean(ratios.map((r) => Math.log(r.cpu)))),
+ wallRatio: Math.exp(mean(ratios.map((r) => Math.log(r.wall)))),
+ }
+ } finally {
+ worker.kill()
+ }
+}
+
+async function main() {
+ const { values } = parseArgs({
+ options: {
+ baseline: { type: 'string' },
+ current: { type: 'string', default: resolve(projectRoot, 'dist') },
+ mode: { type: 'string', default: 'all' },
+ repeats: { type: 'string', default: '4' },
+ outputJson: { type: 'string' },
+ testNamePattern: { type: 'string', short: 't' },
+ },
+ })
+ if (!values.baseline || !values.outputJson) {
+ throw new Error(
+ 'Specify --baseline and --outputJson ',
+ )
+ }
+ const repeats = Number(values.repeats)
+ if (!Number.isInteger(repeats) || repeats < 3 || repeats > 11) {
+ throw new Error('--repeats must be an integer between 3 and 11')
+ }
+ if (!['all', 'client', 'ssr'].includes(values.mode)) {
+ throw new Error('--mode must be all, client, or ssr')
+ }
+ const modes: Array =
+ values.mode === 'all'
+ ? ['client', 'ssr']
+ : values.mode === 'client'
+ ? ['client']
+ : ['ssr']
+ const pattern = values.testNamePattern
+ ? new RegExp(values.testNamePattern)
+ : undefined
+ const cases = LINK_CASES.filter(
+ (c) => !pattern || pattern.test(`${c.label} ${c.id}`),
+ )
+ if (!cases.length) {
+ throw new Error('No Link workloads match the requested pattern')
+ }
+ const report: {
+ protocol: string
+ node: string
+ complete: boolean
+ results: Array<{
+ mode: Mode
+ caseId: LinkCaseId
+ baselineSha256: string
+ currentSha256: string
+ replicas: Array>>
+ cpu: ReturnType
+ wall: ReturnType
+ verdict: ReturnType
+ }>
+ } = {
+ protocol:
+ 'fresh process per case/replica; shared React runtime; separately loaded router variants; 2 ABBA/BAAB rounds; ~500ms calibrated fixed-work blocks; >=2s/100 batches warmup; main-thread CPU and wall time; fixed V8 random/hash seeds',
+ node: process.version,
+ complete: false,
+ results: [],
+ }
+ const output = resolve(values.outputJson)
+ mkdirSync(dirname(output), { recursive: true })
+ const staging = createStagingDirectory()
+ try {
+ for (const mode of modes) {
+ const baselineInput = resolve(values.baseline, mode, 'app.js')
+ const currentInput = resolve(values.current, mode, 'app.js')
+ // Both snapshots resolve React from the same package installation.
+ const baseline = resolve(staging, `baseline-${mode}.mjs`)
+ const current = resolve(staging, `current-${mode}.mjs`)
+ copyFileSync(baselineInput, baseline)
+ copyFileSync(currentInput, current)
+ const digest = (file: string) =>
+ createHash('sha256').update(readFileSync(file)).digest('hex')
+ const baselineSha256 = digest(baseline)
+ const currentSha256 = digest(current)
+ for (const { id } of cases) {
+ const replicas = []
+ for (let replica = 0; replica < repeats; replica++) {
+ replicas.push(
+ await sampleReplica(mode, id, baseline, current, replica),
+ )
+ }
+ const cpu = summarizeRatios(replicas.map((r) => r.cpuRatio))
+ const wall = summarizeRatios(replicas.map((r) => r.wallRatio))
+ const verdict = classify(cpu, wall)
+ report.results.push({
+ mode,
+ caseId: id,
+ baselineSha256,
+ currentSha256,
+ replicas,
+ cpu,
+ wall,
+ verdict,
+ })
+ writeFileSync(output, JSON.stringify(report, null, 2))
+ console.log(
+ `${mode} ${id}: CPU ${cpu.changePercent.toFixed(2)}% [${cpu.low95.toFixed(2)}, ${cpu.high95.toFixed(2)}], wall ${wall.changePercent.toFixed(2)}% [${wall.low95.toFixed(2)}, ${wall.high95.toFixed(2)}] ${verdict}`,
+ )
+ }
+ }
+ report.complete = true
+ writeFileSync(output, JSON.stringify(report, null, 2))
+ } finally {
+ rmSync(staging, { recursive: true })
+ }
+}
+
+await main()
diff --git a/benchmarks/client-nav/link-performance/stable-worker.test.ts b/benchmarks/client-nav/link-performance/stable-worker.test.ts
new file mode 100644
index 0000000000..087b32414a
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/stable-worker.test.ts
@@ -0,0 +1,60 @@
+import { fork } from 'node:child_process'
+import { rmdirSync, unlinkSync, writeFileSync } from 'node:fs'
+import { join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { expect, test } from 'vitest'
+import { createStagingDirectory } from './staging'
+import type { WorkerResponse } from './worker-protocol'
+
+test('loads emitted JavaScript without retranspiling it through SWC', async () => {
+ const directory = createStagingDirectory()
+ const bundle = join(directory, 'app.mjs')
+ const definition = 'function untouched ( ) { return 1 }'
+ writeFileSync(
+ bundle,
+ `${definition}\nawait Promise.resolve()\nthrow new Error(untouched.toString())`,
+ )
+ const worker = fork(
+ fileURLToPath(new URL('./stable-worker.ts', import.meta.url)),
+ {
+ cwd: fileURLToPath(new URL('../../../', import.meta.url)),
+ execArgv: ['--import=@swc-node/register/esm-register'],
+ env: { ...process.env, NODE_ENV: 'production' },
+ stdio: ['ignore', 'ignore', 'pipe', 'ipc'],
+ },
+ )
+ let stderr = ''
+ worker.stderr?.on('data', (data: Buffer) => {
+ stderr += data.toString()
+ })
+ let timeout: ReturnType | undefined
+ try {
+ const result = new Promise((resolve, reject) => {
+ worker.once('message', (message: WorkerResponse) => resolve(message))
+ worker.once('error', reject)
+ worker.once('exit', (code) => {
+ reject(new Error(`Worker exited (${code}): ${stderr}`))
+ })
+ timeout = setTimeout(() => {
+ reject(new Error(`Worker timed out: ${stderr}`))
+ }, 5_000)
+ })
+ worker.send({
+ kind: 'init',
+ mode: 'ssr',
+ caseId: 'shared-params',
+ bundle,
+ variant: 0,
+ })
+ const response = await result
+ expect(response.kind).toBe('error')
+ if (response.kind === 'error') {
+ expect(response.message).toContain(`Error: ${definition}`)
+ }
+ } finally {
+ clearTimeout(timeout)
+ worker.kill()
+ unlinkSync(bundle)
+ rmdirSync(directory)
+ }
+})
diff --git a/benchmarks/client-nav/link-performance/stable-worker.ts b/benchmarks/client-nav/link-performance/stable-worker.ts
new file mode 100644
index 0000000000..d98679dc15
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/stable-worker.ts
@@ -0,0 +1,112 @@
+import { pathToFileURL } from 'node:url'
+import { createClientScenario, createSsrScenario } from './scenario'
+import type { LinkScenario } from './scenario'
+import type { WorkerRequest, WorkerResponse } from './worker-protocol'
+import type * as ClientApp from './src/client'
+import type * as SsrApp from './src/ssr'
+
+const scenarios: Array = []
+const creationOrder: Array = []
+let closeWindow = () => {}
+
+function reply(response: WorkerResponse) {
+ if (!process.send) {
+ throw new Error('The Link sampling worker requires an IPC parent')
+ }
+ process.send(response)
+}
+
+async function handle(request: WorkerRequest) {
+ if (request.kind === 'init') {
+ if (typeof process.threadCpuUsage !== 'function') {
+ throw new Error(
+ 'Stable sampling requires Node.js with process.threadCpuUsage',
+ )
+ }
+ if (scenarios[request.variant]) {
+ throw new Error('A worker must only initialize each variant once')
+ }
+ let scenario: LinkScenario
+ const bundleUrl = pathToFileURL(request.bundle)
+ bundleUrl.searchParams.set('linkPerfVariant', String(request.variant))
+ if (request.mode === 'client') {
+ const { window } = await import('../jsdom')
+ closeWindow = () => window.close()
+ const app: typeof ClientApp = await import(bundleUrl.href)
+ if (app.serverEnvironment !== false) {
+ throw new Error('Expected a production client bundle')
+ }
+ scenario = createClientScenario(app, request.caseId)
+ } else {
+ const app: typeof SsrApp = await import(bundleUrl.href)
+ if (app.serverEnvironment !== true) {
+ throw new Error('Expected a production SSR bundle')
+ }
+ scenario = createSsrScenario(app, request.caseId)
+ }
+ scenarios[request.variant] = scenario
+ creationOrder.push(scenario)
+ await scenario.setup()
+ const start = performance.now()
+ let iterations = 0
+ do {
+ await scenario.batch()
+ iterations++
+ } while (iterations < 100 || performance.now() - start < 2_000)
+ reply({
+ kind: 'ready',
+ batchMs: (performance.now() - start) / iterations,
+ })
+ return
+ }
+ if (request.kind === 'measure') {
+ const scenario = scenarios[request.variant]
+ if (!scenario) {
+ throw new Error('The sampling worker has not been initialized')
+ }
+ if (!Number.isInteger(request.iterations) || request.iterations < 1) {
+ throw new Error('Expected a positive batch count')
+ }
+ const cpuStart = process.threadCpuUsage()
+ const processStart = process.cpuUsage()
+ const start = performance.now()
+ for (let index = 0; index < request.iterations; index++) {
+ await scenario.batch()
+ }
+ const wallMs = performance.now() - start
+ const cpu = process.threadCpuUsage(cpuStart)
+ const processCpu = process.cpuUsage(processStart)
+ reply({
+ kind: 'sample',
+ sample: {
+ iterations: request.iterations,
+ wallMs: wallMs / request.iterations,
+ cpuMs: (cpu.user + cpu.system) / 1_000 / request.iterations,
+ processCpuMs:
+ (processCpu.user + processCpu.system) / 1_000 / request.iterations,
+ },
+ })
+ return
+ }
+ try {
+ for (const scenario of creationOrder) {
+ scenario.check()
+ }
+ } finally {
+ for (const scenario of creationOrder.reverse()) {
+ scenario.teardown()
+ }
+ closeWindow()
+ }
+ reply({ kind: 'stopped' })
+}
+
+process.on('message', (request: WorkerRequest) => {
+ void handle(request).catch((error: unknown) => {
+ reply({
+ kind: 'error',
+ message:
+ error instanceof Error ? error.stack || error.message : String(error),
+ })
+ })
+})
diff --git a/benchmarks/client-nav/link-performance/staging.ts b/benchmarks/client-nav/link-performance/staging.ts
new file mode 100644
index 0000000000..ac07d34c29
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/staging.ts
@@ -0,0 +1,10 @@
+import { mkdirSync, mkdtempSync } from 'node:fs'
+import { resolve } from 'node:path'
+import { fileURLToPath } from 'node:url'
+
+export function createStagingDirectory() {
+ // SWC skips node_modules, leaving the emitted benchmark JavaScript intact.
+ const root = fileURLToPath(new URL('./node_modules/.cache/', import.meta.url))
+ mkdirSync(root, { recursive: true })
+ return mkdtempSync(resolve(root, 'link-performance-'))
+}
diff --git a/benchmarks/client-nav/link-performance/statistics.test.ts b/benchmarks/client-nav/link-performance/statistics.test.ts
new file mode 100644
index 0000000000..8f5f37413b
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/statistics.test.ts
@@ -0,0 +1,36 @@
+import { expect, test } from 'vitest'
+import { classify, mean, summarizeRatios } from './statistics'
+
+test('summarizes multiplicative paired changes across process replicas', () => {
+ const result = summarizeRatios([0.9, 0.9, 0.9, 0.9])
+ expect(result.changePercent).toBeCloseTo(-10)
+ expect(result.low95).toBeCloseTo(-10)
+ expect(result.high95).toBeCloseTo(-10)
+ expect(result.replicas).toBe(4)
+})
+
+test('does not turn opposite noisy runs into a conclusive result', () => {
+ const result = summarizeRatios([0.9, 1.1, 0.95, 1.05])
+ expect(result.low95).toBeLessThan(0)
+ expect(result.high95).toBeGreaterThan(0)
+ expect(classify(result, result)).toBe('inconclusive')
+})
+
+test('requires CPU and wall time to corroborate a direction', () => {
+ const slower = summarizeRatios([1.08, 1.09, 1.08, 1.09])
+ const faster = summarizeRatios([0.9, 0.91, 0.9, 0.91])
+ expect(classify(slower, slower)).toBe('slower')
+ expect(classify(faster, faster)).toBe('faster')
+ expect(classify(slower, faster)).toBe('inconclusive')
+ expect(classify(summarizeRatios([1, 1, 1]), summarizeRatios([1, 1, 1]))).toBe(
+ 'within-2%',
+ )
+})
+
+test('rejects incomplete or invalid sampling data', () => {
+ expect(() => summarizeRatios([1])).toThrow()
+ expect(() => summarizeRatios([0, 1])).toThrow()
+ expect(() => summarizeRatios([NaN, 1])).toThrow()
+ expect(() => mean([])).toThrow()
+ expect(() => mean([Infinity])).toThrow()
+})
diff --git a/benchmarks/client-nav/link-performance/statistics.ts b/benchmarks/client-nav/link-performance/statistics.ts
new file mode 100644
index 0000000000..469bdaf65a
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/statistics.ts
@@ -0,0 +1,57 @@
+const critical95 = [
+ 12.7062, 4.3027, 3.1824, 2.7764, 2.5706, 2.4469, 2.3646, 2.306, 2.2622,
+ 2.2281,
+]
+
+export function mean(values: ReadonlyArray) {
+ if (!values.length || values.some((value) => !Number.isFinite(value))) {
+ throw new Error('Expected finite, nonempty samples')
+ }
+ return values.reduce((sum, value) => sum + value, 0) / values.length
+}
+
+export function summarizeRatios(ratios: ReadonlyArray) {
+ if (
+ ratios.length < 2 ||
+ ratios.length > 11 ||
+ ratios.some((value) => value <= 0)
+ ) {
+ throw new Error('Expected 2-11 independent positive process-replica ratios')
+ }
+ const logs = ratios.map(Math.log)
+ const center = mean(logs)
+ const variance =
+ logs.reduce((sum, value) => sum + (value - center) ** 2, 0) /
+ (logs.length - 1)
+ // Replicas, not the many correlated batches inside a worker, are the samples.
+ const margin =
+ critical95[logs.length - 2]! * Math.sqrt(variance / logs.length)
+ const percent = (value: number) => (Math.exp(value) - 1) * 100
+ return {
+ changePercent: percent(center),
+ low95: percent(center - margin),
+ high95: percent(center + margin),
+ replicas: ratios.length,
+ }
+}
+
+export function classify(
+ cpu: ReturnType,
+ wall: ReturnType,
+) {
+ if (cpu.low95 > 0 && wall.low95 > 0) {
+ return 'slower'
+ }
+ if (cpu.high95 < 0 && wall.high95 < 0) {
+ return 'faster'
+ }
+ if (
+ cpu.low95 >= -2 &&
+ cpu.high95 <= 2 &&
+ wall.low95 >= -2 &&
+ wall.high95 <= 2
+ ) {
+ return 'within-2%'
+ }
+ return 'inconclusive'
+}
diff --git a/benchmarks/client-nav/link-performance/tsconfig.json b/benchmarks/client-nav/link-performance/tsconfig.json
new file mode 100644
index 0000000000..fbf230c977
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "extends": "../tsconfig.json",
+ "compilerOptions": {
+ "jsx": "react-jsx",
+ "jsxImportSource": "react",
+ "types": ["node", "vite/client", "vitest/globals"]
+ },
+ "include": [
+ "./**/*.ts",
+ "./**/*.tsx",
+ "../scenarios/harness.ts",
+ "../setup-helpers.ts",
+ "../vitest.setup.ts"
+ ]
+}
diff --git a/benchmarks/client-nav/link-performance/vite.client.config.ts b/benchmarks/client-nav/link-performance/vite.client.config.ts
new file mode 100644
index 0000000000..1cd45fc45e
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/vite.client.config.ts
@@ -0,0 +1,3 @@
+import { createLinkPerformanceConfig } from './config'
+
+export default createLinkPerformanceConfig('client')
diff --git a/benchmarks/client-nav/link-performance/vite.ssr.config.ts b/benchmarks/client-nav/link-performance/vite.ssr.config.ts
new file mode 100644
index 0000000000..f59148eaf6
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/vite.ssr.config.ts
@@ -0,0 +1,3 @@
+import { createLinkPerformanceConfig } from './config'
+
+export default createLinkPerformanceConfig('ssr')
diff --git a/benchmarks/client-nav/link-performance/vitest.config.ts b/benchmarks/client-nav/link-performance/vitest.config.ts
new file mode 100644
index 0000000000..f8454c819d
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/vitest.config.ts
@@ -0,0 +1,11 @@
+import { fileURLToPath } from 'node:url'
+import { defineConfig } from 'vitest/config'
+
+export default defineConfig({
+ root: fileURLToPath(new URL('.', import.meta.url)),
+ test: {
+ watch: false,
+ environment: 'node',
+ include: ['*.test.ts'],
+ },
+})
diff --git a/benchmarks/client-nav/link-performance/worker-protocol.ts b/benchmarks/client-nav/link-performance/worker-protocol.ts
new file mode 100644
index 0000000000..474858a529
--- /dev/null
+++ b/benchmarks/client-nav/link-performance/worker-protocol.ts
@@ -0,0 +1,28 @@
+import type { LinkCaseId } from './cases'
+
+export type Mode = 'client' | 'ssr'
+export type Variant = 0 | 1
+
+export type WorkerRequest =
+ | {
+ kind: 'init'
+ mode: Mode
+ caseId: LinkCaseId
+ bundle: string
+ variant: Variant
+ }
+ | { kind: 'measure'; iterations: number; variant: Variant }
+ | { kind: 'stop' }
+
+export interface BlockSample {
+ wallMs: number
+ cpuMs: number
+ processCpuMs: number
+ iterations: number
+}
+
+export type WorkerResponse =
+ | { kind: 'ready'; batchMs: number }
+ | { kind: 'sample'; sample: BlockSample }
+ | { kind: 'stopped' }
+ | { kind: 'error'; message: string }
diff --git a/benchmarks/client-nav/package.json b/benchmarks/client-nav/package.json
index 386028271f..1f878adc67 100644
--- a/benchmarks/client-nav/package.json
+++ b/benchmarks/client-nav/package.json
@@ -9,17 +9,16 @@
"test:flame:react": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./react/speed.flame.ts",
"test:flame:solid": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./solid/speed.flame.ts",
"test:flame:vue": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./vue/speed.flame.ts",
- "test:perf": "NODE_ENV=production vitest bench --config ./vitest.config.ts",
- "test:perf:react": "NODE_ENV=production vitest bench --config ./vitest.react.config.ts",
- "test:perf:solid": "NODE_ENV=production vitest bench --config ./vitest.solid.config.ts",
- "test:perf:vue": "NODE_ENV=production vitest bench --config ./vitest.vue.config.ts",
+ "test:perf": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.config.ts",
+ "test:perf:react": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.react.config.ts",
+ "test:perf:solid": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.solid.config.ts",
+ "test:perf:vue": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.vue.config.ts",
"test:types": "pnpm run test:types:react && pnpm run test:types:solid && pnpm run test:types:vue",
"test:types:react": "tsc -p ./react/tsconfig.json --noEmit",
"test:types:solid": "tsc -p ./solid/tsconfig.json --noEmit",
"test:types:vue": "tsc -p ./vue/tsconfig.json --noEmit"
},
"dependencies": {
- "@solidjs/web": "^2.0.0-rc.20",
"@tanstack/history": "workspace:^",
"@tanstack/react-router": "workspace:^",
"@tanstack/router-core": "workspace:^",
@@ -27,24 +26,26 @@
"@tanstack/vue-router": "workspace:^",
"react": "^19.0.0",
"react-dom": "^19.0.0",
- "solid-js": "^2.0.0-rc.20",
+ "solid-js": "^1.9.10",
"vue": "^3.5.16"
},
"devDependencies": {
- "@codspeed/vitest-plugin": "^5.5.0",
"@platformatic/flame": "^1.6.0",
- "@solidjs/vite-plugin": "^3.0.0-next.54",
+ "@codspeed/vitest-plugin": "^6.0.1",
"@tanstack/router-plugin": "workspace:^",
"@testing-library/react": "^16.2.0",
- "@types/jsdom": "28.0.0",
"@vitejs/plugin-react": "^6.0.1",
"@vitejs/plugin-vue": "^6.0.5",
"@vitejs/plugin-vue-jsx": "^5.1.5",
+ "@types/jsdom": "28.0.0",
+ "@types/react": "catalog:",
+ "@types/react-dom": "catalog:",
"@typescript/native": "npm:typescript@^7.0.2",
"jsdom": "^29.1.1",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14",
- "vitest": "^4.1.4"
+ "vite-plugin-solid": "^2.11.11",
+ "vitest": "catalog:"
},
"nx": {
"targets": {
@@ -63,6 +64,8 @@
"@benchmarks/client-nav-control-flow-react",
"@benchmarks/client-nav-head-react",
"@benchmarks/client-nav-history-react",
+ "@benchmarks/client-nav-hydration-react",
+ "@benchmarks/client-nav-link-churn-react",
"@benchmarks/client-nav-links-react",
"@benchmarks/client-nav-loaders-react",
"@benchmarks/client-nav-mount-react",
@@ -91,6 +94,8 @@
"@benchmarks/client-nav-control-flow-solid",
"@benchmarks/client-nav-head-solid",
"@benchmarks/client-nav-history-solid",
+ "@benchmarks/client-nav-hydration-solid",
+ "@benchmarks/client-nav-link-churn-solid",
"@benchmarks/client-nav-links-solid",
"@benchmarks/client-nav-loaders-solid",
"@benchmarks/client-nav-mount-solid",
@@ -119,6 +124,7 @@
"@benchmarks/client-nav-control-flow-vue",
"@benchmarks/client-nav-head-vue",
"@benchmarks/client-nav-history-vue",
+ "@benchmarks/client-nav-link-churn-vue",
"@benchmarks/client-nav-links-vue",
"@benchmarks/client-nav-loaders-vue",
"@benchmarks/client-nav-mount-vue",
@@ -177,7 +183,13 @@
]
},
"test:types": {
- "cache": false,
+ "inputs": [
+ "default",
+ "^production",
+ "{workspaceRoot}/eslint.config.js",
+ "{workspaceRoot}/benchmarks/cpu-simulation.ts",
+ "dependentTaskOutputs"
+ ],
"dependsOn": [
"^build",
{
@@ -194,8 +206,13 @@
"@benchmarks/client-nav-history-react",
"@benchmarks/client-nav-history-solid",
"@benchmarks/client-nav-history-vue",
+ "@benchmarks/client-nav-hydration-react",
+ "@benchmarks/client-nav-hydration-solid",
+ "@benchmarks/client-nav-link-churn-react",
"@benchmarks/client-nav-links-react",
+ "@benchmarks/client-nav-link-churn-solid",
"@benchmarks/client-nav-links-solid",
+ "@benchmarks/client-nav-link-churn-vue",
"@benchmarks/client-nav-links-vue",
"@benchmarks/client-nav-loaders-react",
"@benchmarks/client-nav-loaders-solid",
diff --git a/benchmarks/client-nav/react/speed.bench.ts b/benchmarks/client-nav/react/speed.bench.ts
index fcc15b5fbc..944f182734 100644
--- a/benchmarks/client-nav/react/speed.bench.ts
+++ b/benchmarks/client-nav/react/speed.bench.ts
@@ -1,34 +1,19 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
+import { test } from 'vitest'
import { setup } from './setup'
-describe('client-nav', () => {
- const test = setup()
+test('client-nav', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores "suite hooks" like `beforeAll` and `afterAll`,
- * so we use tinybench's `setup` and `teardown` options to run our setup and teardown logic.
- *
- * But CodSpeed calls the benchmarked function directly, bypassing `setup` and `teardown`,
- * but it does support `beforeAll` and `afterAll`.
- *
- * So it looks like we're setting up in duplicate, but in reality, it's only running once per environment, as intended.
- */
-
- beforeAll(test.before)
- afterAll(test.after)
-
- bench(
+ await bench(
'client-side navigation loop (react)',
+ { beforeAll: scenario.before, afterAll: scenario.after },
async () => {
for (let i = 0; i < 10; i++) {
- await test.tick()
+ await scenario.tick()
}
},
- {
- warmupIterations: 100,
- time: 10_000,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run({
+ warmupIterations: 100,
+ time: 10_000,
+ })
})
diff --git a/benchmarks/client-nav/react/vite.config.ts b/benchmarks/client-nav/react/vite.config.ts
index adc31ddd64..7df3f80e71 100644
--- a/benchmarks/client-nav/react/vite.config.ts
+++ b/benchmarks/client-nav/react/vite.config.ts
@@ -2,6 +2,7 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import codspeedPlugin from '@codspeed/vitest-plugin'
+import { cpuSimulationExecArgv } from '../../cpu-simulation'
// Anchor the project root to the package directory so this config resolves
// identically when run directly and as part of an aggregate `projects` config.
@@ -28,9 +29,11 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav (react)',
watch: false,
environment: 'jsdom',
setupFiles: [`${rootDir}vitest.setup.ts`],
+ benchmark: { include: ['react/speed.bench.ts'] },
},
})
diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts b/benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts
index c3f4c5231c..65dab0781e 100644
--- a/benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-async-pipeline', () => {
- const test = setup()
+test('client-async-pipeline', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-async-pipeline navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/vite.config.ts b/benchmarks/client-nav/scenarios/async-pipeline/react/vite.config.ts
index 7161c9a13d..e36a5244b1 100644
--- a/benchmarks/client-nav/scenarios/async-pipeline/react/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/async-pipeline/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -32,6 +33,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav async-pipeline (react)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts
index 96082e9963..acef710469 100644
--- a/benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-async-pipeline', () => {
- const test = setup()
+test('client-async-pipeline', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-async-pipeline navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx b/benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx
index 4f6d12dba4..4c6d49f501 100644
--- a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx
+++ b/benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx
@@ -1,5 +1,5 @@
import type { RouterHistory } from '@tanstack/history'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { RouterProvider, createRouter } from '@tanstack/solid-router'
import { routeTree } from './routeTree.gen'
diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routeTree.gen.ts
index 7c15baf4e9..27b9498b11 100644
--- a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routeTree.gen.ts
@@ -9,25 +9,25 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as NestedRouteImport } from './routes/nested'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as SlowIdRouteImport } from './routes/slow.$id'
-import { Route as NestedIdRouteImport } from './routes/nested.$id'
+import { Route as NestedRouteImport } from './routes/nested'
import { Route as CtxIdRouteImport } from './routes/ctx.$id'
+import { Route as NestedIdRouteImport } from './routes/nested.$id'
+import { Route as SlowIdRouteImport } from './routes/slow.$id'
-const NestedRoute = NestedRouteImport.update({
- id: '/nested',
- path: '/nested',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const SlowIdRoute = SlowIdRouteImport.update({
- id: '/slow/$id',
- path: '/slow/$id',
+const NestedRoute = NestedRouteImport.update({
+ id: '/nested',
+ path: '/nested',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const CtxIdRoute = CtxIdRouteImport.update({
+ id: '/ctx/$id',
+ path: '/ctx/$id',
getParentRoute: () => rootRouteImport,
} as any)
const NestedIdRoute = NestedIdRouteImport.update({
@@ -35,9 +35,9 @@ const NestedIdRoute = NestedIdRouteImport.update({
path: '/$id',
getParentRoute: () => NestedRoute,
} as any)
-const CtxIdRoute = CtxIdRouteImport.update({
- id: '/ctx/$id',
- path: '/ctx/$id',
+const SlowIdRoute = SlowIdRouteImport.update({
+ id: '/slow/$id',
+ path: '/slow/$id',
getParentRoute: () => rootRouteImport,
} as any)
@@ -80,13 +80,6 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/nested': {
- id: '/nested'
- path: '/nested'
- fullPath: '/nested'
- preLoaderRoute: typeof NestedRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -94,11 +87,18 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
- '/slow/$id': {
- id: '/slow/$id'
- path: '/slow/$id'
- fullPath: '/slow/$id'
- preLoaderRoute: typeof SlowIdRouteImport
+ '/nested': {
+ id: '/nested'
+ path: '/nested'
+ fullPath: '/nested'
+ preLoaderRoute: typeof NestedRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/ctx/$id': {
+ id: '/ctx/$id'
+ path: '/ctx/$id'
+ fullPath: '/ctx/$id'
+ preLoaderRoute: typeof CtxIdRouteImport
parentRoute: typeof rootRouteImport
}
'/nested/$id': {
@@ -108,11 +108,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof NestedIdRouteImport
parentRoute: typeof NestedRoute
}
- '/ctx/$id': {
- id: '/ctx/$id'
- path: '/ctx/$id'
- fullPath: '/ctx/$id'
- preLoaderRoute: typeof CtxIdRouteImport
+ '/slow/$id': {
+ id: '/slow/$id'
+ path: '/slow/$id'
+ fullPath: '/slow/$id'
+ preLoaderRoute: typeof SlowIdRouteImport
parentRoute: typeof rootRouteImport
}
}
diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/tsconfig.json b/benchmarks/client-nav/scenarios/async-pipeline/solid/tsconfig.json
index 8c57ff876a..98d76ad6b8 100644
--- a/benchmarks/client-nav/scenarios/async-pipeline/solid/tsconfig.json
+++ b/benchmarks/client-nav/scenarios/async-pipeline/solid/tsconfig.json
@@ -2,7 +2,7 @@
"extends": "../../../../../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"allowImportingTsExtensions": true,
"types": ["node", "vite/client", "vitest/globals"]
},
diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/vite.config.ts b/benchmarks/client-nav/scenarios/async-pipeline/solid/vite.config.ts
index a53f61652b..214da8042e 100644
--- a/benchmarks/client-nav/scenarios/async-pipeline/solid/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/async-pipeline/solid/vite.config.ts
@@ -1,8 +1,9 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -19,7 +20,7 @@ export default defineConfig({
routesDirectory: `${rootDir}src/routes`,
generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
}),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -35,6 +36,7 @@ export default defineConfig({
conditions: ['solid', 'browser'],
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav async-pipeline (solid)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts
index 193a3837df..f0fd3e58df 100644
--- a/benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-async-pipeline', () => {
- const test = setup()
+test('client-async-pipeline', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-async-pipeline navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routeTree.gen.ts
index ce26dc62d1..66b9efd7aa 100644
--- a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routeTree.gen.ts
@@ -9,25 +9,25 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as NestedRouteImport } from './routes/nested'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as SlowIdRouteImport } from './routes/slow.$id'
-import { Route as NestedIdRouteImport } from './routes/nested.$id'
+import { Route as NestedRouteImport } from './routes/nested'
import { Route as CtxIdRouteImport } from './routes/ctx.$id'
+import { Route as NestedIdRouteImport } from './routes/nested.$id'
+import { Route as SlowIdRouteImport } from './routes/slow.$id'
-const NestedRoute = NestedRouteImport.update({
- id: '/nested',
- path: '/nested',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const SlowIdRoute = SlowIdRouteImport.update({
- id: '/slow/$id',
- path: '/slow/$id',
+const NestedRoute = NestedRouteImport.update({
+ id: '/nested',
+ path: '/nested',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const CtxIdRoute = CtxIdRouteImport.update({
+ id: '/ctx/$id',
+ path: '/ctx/$id',
getParentRoute: () => rootRouteImport,
} as any)
const NestedIdRoute = NestedIdRouteImport.update({
@@ -35,9 +35,9 @@ const NestedIdRoute = NestedIdRouteImport.update({
path: '/$id',
getParentRoute: () => NestedRoute,
} as any)
-const CtxIdRoute = CtxIdRouteImport.update({
- id: '/ctx/$id',
- path: '/ctx/$id',
+const SlowIdRoute = SlowIdRouteImport.update({
+ id: '/slow/$id',
+ path: '/slow/$id',
getParentRoute: () => rootRouteImport,
} as any)
@@ -80,13 +80,6 @@ export interface RootRouteChildren {
declare module '@tanstack/vue-router' {
interface FileRoutesByPath {
- '/nested': {
- id: '/nested'
- path: '/nested'
- fullPath: '/nested'
- preLoaderRoute: typeof NestedRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -94,11 +87,18 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
- '/slow/$id': {
- id: '/slow/$id'
- path: '/slow/$id'
- fullPath: '/slow/$id'
- preLoaderRoute: typeof SlowIdRouteImport
+ '/nested': {
+ id: '/nested'
+ path: '/nested'
+ fullPath: '/nested'
+ preLoaderRoute: typeof NestedRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/ctx/$id': {
+ id: '/ctx/$id'
+ path: '/ctx/$id'
+ fullPath: '/ctx/$id'
+ preLoaderRoute: typeof CtxIdRouteImport
parentRoute: typeof rootRouteImport
}
'/nested/$id': {
@@ -108,11 +108,11 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof NestedIdRouteImport
parentRoute: typeof NestedRoute
}
- '/ctx/$id': {
- id: '/ctx/$id'
- path: '/ctx/$id'
- fullPath: '/ctx/$id'
- preLoaderRoute: typeof CtxIdRouteImport
+ '/slow/$id': {
+ id: '/slow/$id'
+ path: '/slow/$id'
+ fullPath: '/slow/$id'
+ preLoaderRoute: typeof SlowIdRouteImport
parentRoute: typeof rootRouteImport
}
}
diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/vite.config.ts b/benchmarks/client-nav/scenarios/async-pipeline/vue/vite.config.ts
index e16a8ee828..ce4fa7318a 100644
--- a/benchmarks/client-nav/scenarios/async-pipeline/vue/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/async-pipeline/vue/vite.config.ts
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -34,6 +35,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav async-pipeline (vue)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts b/benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts
index 7f1153021f..d6f2190be7 100644
--- a/benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-control-flow', () => {
- const test = setup()
+test('client-control-flow', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-control-flow navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/broken.tsx b/benchmarks/client-nav/scenarios/control-flow/react/src/routes/broken.tsx
index 2dc4a26486..b11bb845bc 100644
--- a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/broken.tsx
+++ b/benchmarks/client-nav/scenarios/control-flow/react/src/routes/broken.tsx
@@ -12,5 +12,9 @@ export const Route = createFileRoute('/broken')({
})
function BrokenError(props: ErrorComponentProps) {
- return {props.error.message}
+ return (
+
+ {props.error instanceof Error ? props.error.message : String(props.error)}
+
+ )
}
diff --git a/benchmarks/client-nav/scenarios/control-flow/react/vite.config.ts b/benchmarks/client-nav/scenarios/control-flow/react/vite.config.ts
index 1aa2c1fa35..1eefca0fc3 100644
--- a/benchmarks/client-nav/scenarios/control-flow/react/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/control-flow/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -32,6 +33,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav control-flow (react)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts
index a88093ca52..d803d2a313 100644
--- a/benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-control-flow', () => {
- const test = setup()
+test('client-control-flow', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-control-flow navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx b/benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx
index f7148011f5..fa9d239418 100644
--- a/benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx
+++ b/benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx
@@ -1,5 +1,5 @@
import type { RouterHistory } from '@tanstack/history'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { RouterProvider, createRouter } from '@tanstack/solid-router'
import { routeTree } from './routeTree.gen'
diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/control-flow/solid/src/routeTree.gen.ts
index 44d88e9f8d..cd84f99d5d 100644
--- a/benchmarks/client-nav/scenarios/control-flow/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/control-flow/solid/src/routeTree.gen.ts
@@ -9,26 +9,16 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as TargetRouteImport } from './routes/target'
-import { Route as Hop2RouteImport } from './routes/hop2'
-import { Route as Hop1RouteImport } from './routes/hop1'
-import { Route as BrokenRouteImport } from './routes/broken'
import { Route as IndexRouteImport } from './routes/index'
+import { Route as BrokenRouteImport } from './routes/broken'
+import { Route as Hop1RouteImport } from './routes/hop1'
+import { Route as Hop2RouteImport } from './routes/hop2'
+import { Route as TargetRouteImport } from './routes/target'
import { Route as MissingIdRouteImport } from './routes/missing.$id'
-const TargetRoute = TargetRouteImport.update({
- id: '/target',
- path: '/target',
- getParentRoute: () => rootRouteImport,
-} as any)
-const Hop2Route = Hop2RouteImport.update({
- id: '/hop2',
- path: '/hop2',
- getParentRoute: () => rootRouteImport,
-} as any)
-const Hop1Route = Hop1RouteImport.update({
- id: '/hop1',
- path: '/hop1',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const BrokenRoute = BrokenRouteImport.update({
@@ -36,9 +26,19 @@ const BrokenRoute = BrokenRouteImport.update({
path: '/broken',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const Hop1Route = Hop1RouteImport.update({
+ id: '/hop1',
+ path: '/hop1',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const Hop2Route = Hop2RouteImport.update({
+ id: '/hop2',
+ path: '/hop2',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const TargetRoute = TargetRouteImport.update({
+ id: '/target',
+ path: '/target',
getParentRoute: () => rootRouteImport,
} as any)
const MissingIdRoute = MissingIdRouteImport.update({
@@ -98,25 +98,11 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/target': {
- id: '/target'
- path: '/target'
- fullPath: '/target'
- preLoaderRoute: typeof TargetRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/hop2': {
- id: '/hop2'
- path: '/hop2'
- fullPath: '/hop2'
- preLoaderRoute: typeof Hop2RouteImport
- parentRoute: typeof rootRouteImport
- }
- '/hop1': {
- id: '/hop1'
- path: '/hop1'
- fullPath: '/hop1'
- preLoaderRoute: typeof Hop1RouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/broken': {
@@ -126,11 +112,25 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof BrokenRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/hop1': {
+ id: '/hop1'
+ path: '/hop1'
+ fullPath: '/hop1'
+ preLoaderRoute: typeof Hop1RouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/hop2': {
+ id: '/hop2'
+ path: '/hop2'
+ fullPath: '/hop2'
+ preLoaderRoute: typeof Hop2RouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/target': {
+ id: '/target'
+ path: '/target'
+ fullPath: '/target'
+ preLoaderRoute: typeof TargetRouteImport
parentRoute: typeof rootRouteImport
}
'/missing/$id': {
diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/tsconfig.json b/benchmarks/client-nav/scenarios/control-flow/solid/tsconfig.json
index 8c57ff876a..98d76ad6b8 100644
--- a/benchmarks/client-nav/scenarios/control-flow/solid/tsconfig.json
+++ b/benchmarks/client-nav/scenarios/control-flow/solid/tsconfig.json
@@ -2,7 +2,7 @@
"extends": "../../../../../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"allowImportingTsExtensions": true,
"types": ["node", "vite/client", "vitest/globals"]
},
diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/vite.config.ts b/benchmarks/client-nav/scenarios/control-flow/solid/vite.config.ts
index d5e1af5470..f4fa916154 100644
--- a/benchmarks/client-nav/scenarios/control-flow/solid/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/control-flow/solid/vite.config.ts
@@ -1,8 +1,9 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -19,7 +20,7 @@ export default defineConfig({
routesDirectory: `${rootDir}src/routes`,
generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
}),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -35,6 +36,7 @@ export default defineConfig({
conditions: ['solid', 'browser'],
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav control-flow (solid)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts
index 9a335cfb87..8a019945c7 100644
--- a/benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-control-flow', () => {
- const test = setup()
+test('client-control-flow', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-control-flow navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/control-flow/vue/src/routeTree.gen.ts
index 60fc846f89..6b53a6a203 100644
--- a/benchmarks/client-nav/scenarios/control-flow/vue/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/control-flow/vue/src/routeTree.gen.ts
@@ -9,26 +9,16 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as TargetRouteImport } from './routes/target'
-import { Route as Hop2RouteImport } from './routes/hop2'
-import { Route as Hop1RouteImport } from './routes/hop1'
-import { Route as BrokenRouteImport } from './routes/broken'
import { Route as IndexRouteImport } from './routes/index'
+import { Route as BrokenRouteImport } from './routes/broken'
+import { Route as Hop1RouteImport } from './routes/hop1'
+import { Route as Hop2RouteImport } from './routes/hop2'
+import { Route as TargetRouteImport } from './routes/target'
import { Route as MissingIdRouteImport } from './routes/missing.$id'
-const TargetRoute = TargetRouteImport.update({
- id: '/target',
- path: '/target',
- getParentRoute: () => rootRouteImport,
-} as any)
-const Hop2Route = Hop2RouteImport.update({
- id: '/hop2',
- path: '/hop2',
- getParentRoute: () => rootRouteImport,
-} as any)
-const Hop1Route = Hop1RouteImport.update({
- id: '/hop1',
- path: '/hop1',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const BrokenRoute = BrokenRouteImport.update({
@@ -36,9 +26,19 @@ const BrokenRoute = BrokenRouteImport.update({
path: '/broken',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const Hop1Route = Hop1RouteImport.update({
+ id: '/hop1',
+ path: '/hop1',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const Hop2Route = Hop2RouteImport.update({
+ id: '/hop2',
+ path: '/hop2',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const TargetRoute = TargetRouteImport.update({
+ id: '/target',
+ path: '/target',
getParentRoute: () => rootRouteImport,
} as any)
const MissingIdRoute = MissingIdRouteImport.update({
@@ -98,25 +98,11 @@ export interface RootRouteChildren {
declare module '@tanstack/vue-router' {
interface FileRoutesByPath {
- '/target': {
- id: '/target'
- path: '/target'
- fullPath: '/target'
- preLoaderRoute: typeof TargetRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/hop2': {
- id: '/hop2'
- path: '/hop2'
- fullPath: '/hop2'
- preLoaderRoute: typeof Hop2RouteImport
- parentRoute: typeof rootRouteImport
- }
- '/hop1': {
- id: '/hop1'
- path: '/hop1'
- fullPath: '/hop1'
- preLoaderRoute: typeof Hop1RouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/broken': {
@@ -126,11 +112,25 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof BrokenRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/hop1': {
+ id: '/hop1'
+ path: '/hop1'
+ fullPath: '/hop1'
+ preLoaderRoute: typeof Hop1RouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/hop2': {
+ id: '/hop2'
+ path: '/hop2'
+ fullPath: '/hop2'
+ preLoaderRoute: typeof Hop2RouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/target': {
+ id: '/target'
+ path: '/target'
+ fullPath: '/target'
+ preLoaderRoute: typeof TargetRouteImport
parentRoute: typeof rootRouteImport
}
'/missing/$id': {
diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/vite.config.ts b/benchmarks/client-nav/scenarios/control-flow/vue/vite.config.ts
index 4694cf69c8..3c2750d2a6 100644
--- a/benchmarks/client-nav/scenarios/control-flow/vue/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/control-flow/vue/vite.config.ts
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -34,6 +35,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav control-flow (vue)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/head/react/speed.bench.ts b/benchmarks/client-nav/scenarios/head/react/speed.bench.ts
index 97c76a1a11..d0d731a09f 100644
--- a/benchmarks/client-nav/scenarios/head/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/head/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-head', () => {
- const test = setup()
+test('client-head', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-head navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/head/react/vite.config.ts b/benchmarks/client-nav/scenarios/head/react/vite.config.ts
index 086bd60bb4..7c8d6d4c15 100644
--- a/benchmarks/client-nav/scenarios/head/react/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/head/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -32,6 +33,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav head (react)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/head/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/head/solid/speed.bench.ts
index 075e7673de..ca156c950b 100644
--- a/benchmarks/client-nav/scenarios/head/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/head/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-head', () => {
- const test = setup()
+test('client-head', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-head navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/head/solid/src/main.tsx b/benchmarks/client-nav/scenarios/head/solid/src/main.tsx
index f7148011f5..fa9d239418 100644
--- a/benchmarks/client-nav/scenarios/head/solid/src/main.tsx
+++ b/benchmarks/client-nav/scenarios/head/solid/src/main.tsx
@@ -1,5 +1,5 @@
import type { RouterHistory } from '@tanstack/history'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { RouterProvider, createRouter } from '@tanstack/solid-router'
import { routeTree } from './routeTree.gen'
diff --git a/benchmarks/client-nav/scenarios/head/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/head/solid/src/routeTree.gen.ts
index ead6a4436a..b6f217e527 100644
--- a/benchmarks/client-nav/scenarios/head/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/head/solid/src/routeTree.gen.ts
@@ -9,15 +9,15 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as SettingsRouteImport } from './routes/settings'
-import { Route as DocsRouteImport } from './routes/docs'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as DocsSectionRouteImport } from './routes/docs.$section'
+import { Route as DocsRouteImport } from './routes/docs'
+import { Route as SettingsRouteImport } from './routes/settings'
import { Route as ArticlesIdRouteImport } from './routes/articles.$id'
+import { Route as DocsSectionRouteImport } from './routes/docs.$section'
-const SettingsRoute = SettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const DocsRoute = DocsRouteImport.update({
@@ -25,9 +25,14 @@ const DocsRoute = DocsRouteImport.update({
path: '/docs',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const SettingsRoute = SettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ArticlesIdRoute = ArticlesIdRouteImport.update({
+ id: '/articles/$id',
+ path: '/articles/$id',
getParentRoute: () => rootRouteImport,
} as any)
const DocsSectionRoute = DocsSectionRouteImport.update({
@@ -35,11 +40,6 @@ const DocsSectionRoute = DocsSectionRouteImport.update({
path: '/$section',
getParentRoute: () => DocsRoute,
} as any)
-const ArticlesIdRoute = ArticlesIdRouteImport.update({
- id: '/articles/$id',
- path: '/articles/$id',
- getParentRoute: () => rootRouteImport,
-} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -86,11 +86,11 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/settings': {
- id: '/settings'
- path: '/settings'
- fullPath: '/settings'
- preLoaderRoute: typeof SettingsRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/docs': {
@@ -100,11 +100,18 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof DocsRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/settings': {
+ id: '/settings'
+ path: '/settings'
+ fullPath: '/settings'
+ preLoaderRoute: typeof SettingsRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/articles/$id': {
+ id: '/articles/$id'
+ path: '/articles/$id'
+ fullPath: '/articles/$id'
+ preLoaderRoute: typeof ArticlesIdRouteImport
parentRoute: typeof rootRouteImport
}
'/docs/$section': {
@@ -114,13 +121,6 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof DocsSectionRouteImport
parentRoute: typeof DocsRoute
}
- '/articles/$id': {
- id: '/articles/$id'
- path: '/articles/$id'
- fullPath: '/articles/$id'
- preLoaderRoute: typeof ArticlesIdRouteImport
- parentRoute: typeof rootRouteImport
- }
}
}
diff --git a/benchmarks/client-nav/scenarios/head/solid/tsconfig.json b/benchmarks/client-nav/scenarios/head/solid/tsconfig.json
index 8c57ff876a..98d76ad6b8 100644
--- a/benchmarks/client-nav/scenarios/head/solid/tsconfig.json
+++ b/benchmarks/client-nav/scenarios/head/solid/tsconfig.json
@@ -2,7 +2,7 @@
"extends": "../../../../../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"allowImportingTsExtensions": true,
"types": ["node", "vite/client", "vitest/globals"]
},
diff --git a/benchmarks/client-nav/scenarios/head/solid/vite.config.ts b/benchmarks/client-nav/scenarios/head/solid/vite.config.ts
index fc3876b03e..986b2de2b0 100644
--- a/benchmarks/client-nav/scenarios/head/solid/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/head/solid/vite.config.ts
@@ -1,8 +1,9 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -19,7 +20,7 @@ export default defineConfig({
routesDirectory: `${rootDir}src/routes`,
generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
}),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -35,6 +36,7 @@ export default defineConfig({
conditions: ['solid', 'browser'],
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav head (solid)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/head/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/head/vue/speed.bench.ts
index 7080b4ea7d..d188a9dd7a 100644
--- a/benchmarks/client-nav/scenarios/head/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/head/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-head', () => {
- const test = setup()
+test('client-head', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-head navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/head/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/head/vue/src/routeTree.gen.ts
index b115854c26..161f99a65c 100644
--- a/benchmarks/client-nav/scenarios/head/vue/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/head/vue/src/routeTree.gen.ts
@@ -9,15 +9,15 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as SettingsRouteImport } from './routes/settings'
-import { Route as DocsRouteImport } from './routes/docs'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as DocsSectionRouteImport } from './routes/docs.$section'
+import { Route as DocsRouteImport } from './routes/docs'
+import { Route as SettingsRouteImport } from './routes/settings'
import { Route as ArticlesIdRouteImport } from './routes/articles.$id'
+import { Route as DocsSectionRouteImport } from './routes/docs.$section'
-const SettingsRoute = SettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const DocsRoute = DocsRouteImport.update({
@@ -25,9 +25,14 @@ const DocsRoute = DocsRouteImport.update({
path: '/docs',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const SettingsRoute = SettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ArticlesIdRoute = ArticlesIdRouteImport.update({
+ id: '/articles/$id',
+ path: '/articles/$id',
getParentRoute: () => rootRouteImport,
} as any)
const DocsSectionRoute = DocsSectionRouteImport.update({
@@ -35,11 +40,6 @@ const DocsSectionRoute = DocsSectionRouteImport.update({
path: '/$section',
getParentRoute: () => DocsRoute,
} as any)
-const ArticlesIdRoute = ArticlesIdRouteImport.update({
- id: '/articles/$id',
- path: '/articles/$id',
- getParentRoute: () => rootRouteImport,
-} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -86,11 +86,11 @@ export interface RootRouteChildren {
declare module '@tanstack/vue-router' {
interface FileRoutesByPath {
- '/settings': {
- id: '/settings'
- path: '/settings'
- fullPath: '/settings'
- preLoaderRoute: typeof SettingsRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/docs': {
@@ -100,11 +100,18 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof DocsRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/settings': {
+ id: '/settings'
+ path: '/settings'
+ fullPath: '/settings'
+ preLoaderRoute: typeof SettingsRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/articles/$id': {
+ id: '/articles/$id'
+ path: '/articles/$id'
+ fullPath: '/articles/$id'
+ preLoaderRoute: typeof ArticlesIdRouteImport
parentRoute: typeof rootRouteImport
}
'/docs/$section': {
@@ -114,13 +121,6 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof DocsSectionRouteImport
parentRoute: typeof DocsRoute
}
- '/articles/$id': {
- id: '/articles/$id'
- path: '/articles/$id'
- fullPath: '/articles/$id'
- preLoaderRoute: typeof ArticlesIdRouteImport
- parentRoute: typeof rootRouteImport
- }
}
}
diff --git a/benchmarks/client-nav/scenarios/head/vue/vite.config.ts b/benchmarks/client-nav/scenarios/head/vue/vite.config.ts
index 0ad2067925..bb1126d85f 100644
--- a/benchmarks/client-nav/scenarios/head/vue/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/head/vue/vite.config.ts
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -34,6 +35,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav head (vue)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/history/react/speed.bench.ts b/benchmarks/client-nav/scenarios/history/react/speed.bench.ts
index 9192258b66..6ec7031857 100644
--- a/benchmarks/client-nav/scenarios/history/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/history/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-history', () => {
- const test = setup()
+test('client-history', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-history navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/history/react/vite.config.ts b/benchmarks/client-nav/scenarios/history/react/vite.config.ts
index 61a1b2feef..bdbde9c668 100644
--- a/benchmarks/client-nav/scenarios/history/react/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/history/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -32,6 +33,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav history (react)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/history/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/history/solid/speed.bench.ts
index d7f4fd898d..56af035b2b 100644
--- a/benchmarks/client-nav/scenarios/history/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/history/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-history', () => {
- const test = setup()
+test('client-history', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-history navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/history/solid/src/main.tsx b/benchmarks/client-nav/scenarios/history/solid/src/main.tsx
index f7148011f5..fa9d239418 100644
--- a/benchmarks/client-nav/scenarios/history/solid/src/main.tsx
+++ b/benchmarks/client-nav/scenarios/history/solid/src/main.tsx
@@ -1,5 +1,5 @@
import type { RouterHistory } from '@tanstack/history'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { RouterProvider, createRouter } from '@tanstack/solid-router'
import { routeTree } from './routeTree.gen'
diff --git a/benchmarks/client-nav/scenarios/history/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/history/solid/src/routeTree.gen.ts
index a6ab2a4fc8..af253f4a15 100644
--- a/benchmarks/client-nav/scenarios/history/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/history/solid/src/routeTree.gen.ts
@@ -9,24 +9,19 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as GalleryRouteImport } from './routes/gallery'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as PhotosPhotoIdRouteImport } from './routes/photos.$photoId'
+import { Route as GalleryRouteImport } from './routes/gallery'
import { Route as PagesNRouteImport } from './routes/pages.$n'
+import { Route as PhotosPhotoIdRouteImport } from './routes/photos.$photoId'
-const GalleryRoute = GalleryRouteImport.update({
- id: '/gallery',
- path: '/gallery',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const PhotosPhotoIdRoute = PhotosPhotoIdRouteImport.update({
- id: '/photos/$photoId',
- path: '/photos/$photoId',
+const GalleryRoute = GalleryRouteImport.update({
+ id: '/gallery',
+ path: '/gallery',
getParentRoute: () => rootRouteImport,
} as any)
const PagesNRoute = PagesNRouteImport.update({
@@ -34,6 +29,11 @@ const PagesNRoute = PagesNRouteImport.update({
path: '/pages/$n',
getParentRoute: () => rootRouteImport,
} as any)
+const PhotosPhotoIdRoute = PhotosPhotoIdRouteImport.update({
+ id: '/photos/$photoId',
+ path: '/photos/$photoId',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -71,13 +71,6 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/gallery': {
- id: '/gallery'
- path: '/gallery'
- fullPath: '/gallery'
- preLoaderRoute: typeof GalleryRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -85,11 +78,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
- '/photos/$photoId': {
- id: '/photos/$photoId'
- path: '/photos/$photoId'
- fullPath: '/photos/$photoId'
- preLoaderRoute: typeof PhotosPhotoIdRouteImport
+ '/gallery': {
+ id: '/gallery'
+ path: '/gallery'
+ fullPath: '/gallery'
+ preLoaderRoute: typeof GalleryRouteImport
parentRoute: typeof rootRouteImport
}
'/pages/$n': {
@@ -99,6 +92,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof PagesNRouteImport
parentRoute: typeof rootRouteImport
}
+ '/photos/$photoId': {
+ id: '/photos/$photoId'
+ path: '/photos/$photoId'
+ fullPath: '/photos/$photoId'
+ preLoaderRoute: typeof PhotosPhotoIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
}
}
diff --git a/benchmarks/client-nav/scenarios/history/solid/tsconfig.json b/benchmarks/client-nav/scenarios/history/solid/tsconfig.json
index 8c57ff876a..98d76ad6b8 100644
--- a/benchmarks/client-nav/scenarios/history/solid/tsconfig.json
+++ b/benchmarks/client-nav/scenarios/history/solid/tsconfig.json
@@ -2,7 +2,7 @@
"extends": "../../../../../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"allowImportingTsExtensions": true,
"types": ["node", "vite/client", "vitest/globals"]
},
diff --git a/benchmarks/client-nav/scenarios/history/solid/vite.config.ts b/benchmarks/client-nav/scenarios/history/solid/vite.config.ts
index 8ddc9e6a0c..4da589ff0e 100644
--- a/benchmarks/client-nav/scenarios/history/solid/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/history/solid/vite.config.ts
@@ -1,8 +1,9 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -19,7 +20,7 @@ export default defineConfig({
routesDirectory: `${rootDir}src/routes`,
generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
}),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -35,6 +36,7 @@ export default defineConfig({
conditions: ['solid', 'browser'],
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav history (solid)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/history/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/history/vue/speed.bench.ts
index a378e45ac5..3d36ac4cfa 100644
--- a/benchmarks/client-nav/scenarios/history/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/history/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-history', () => {
- const test = setup()
+test('client-history', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-history navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/history/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/history/vue/src/routeTree.gen.ts
index cee1b68870..519aef7c8f 100644
--- a/benchmarks/client-nav/scenarios/history/vue/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/history/vue/src/routeTree.gen.ts
@@ -9,24 +9,19 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as GalleryRouteImport } from './routes/gallery'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as PhotosPhotoIdRouteImport } from './routes/photos.$photoId'
+import { Route as GalleryRouteImport } from './routes/gallery'
import { Route as PagesNRouteImport } from './routes/pages.$n'
+import { Route as PhotosPhotoIdRouteImport } from './routes/photos.$photoId'
-const GalleryRoute = GalleryRouteImport.update({
- id: '/gallery',
- path: '/gallery',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const PhotosPhotoIdRoute = PhotosPhotoIdRouteImport.update({
- id: '/photos/$photoId',
- path: '/photos/$photoId',
+const GalleryRoute = GalleryRouteImport.update({
+ id: '/gallery',
+ path: '/gallery',
getParentRoute: () => rootRouteImport,
} as any)
const PagesNRoute = PagesNRouteImport.update({
@@ -34,6 +29,11 @@ const PagesNRoute = PagesNRouteImport.update({
path: '/pages/$n',
getParentRoute: () => rootRouteImport,
} as any)
+const PhotosPhotoIdRoute = PhotosPhotoIdRouteImport.update({
+ id: '/photos/$photoId',
+ path: '/photos/$photoId',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -71,13 +71,6 @@ export interface RootRouteChildren {
declare module '@tanstack/vue-router' {
interface FileRoutesByPath {
- '/gallery': {
- id: '/gallery'
- path: '/gallery'
- fullPath: '/gallery'
- preLoaderRoute: typeof GalleryRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -85,11 +78,11 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
- '/photos/$photoId': {
- id: '/photos/$photoId'
- path: '/photos/$photoId'
- fullPath: '/photos/$photoId'
- preLoaderRoute: typeof PhotosPhotoIdRouteImport
+ '/gallery': {
+ id: '/gallery'
+ path: '/gallery'
+ fullPath: '/gallery'
+ preLoaderRoute: typeof GalleryRouteImport
parentRoute: typeof rootRouteImport
}
'/pages/$n': {
@@ -99,6 +92,13 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof PagesNRouteImport
parentRoute: typeof rootRouteImport
}
+ '/photos/$photoId': {
+ id: '/photos/$photoId'
+ path: '/photos/$photoId'
+ fullPath: '/photos/$photoId'
+ preLoaderRoute: typeof PhotosPhotoIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
}
}
diff --git a/benchmarks/client-nav/scenarios/history/vue/vite.config.ts b/benchmarks/client-nav/scenarios/history/vue/vite.config.ts
index 58986d6526..c5f1ca9807 100644
--- a/benchmarks/client-nav/scenarios/history/vue/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/history/vue/vite.config.ts
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -34,6 +35,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav history (vue)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/hydration/react/fixture.ts b/benchmarks/client-nav/scenarios/hydration/react/fixture.ts
new file mode 100644
index 0000000000..950c870a1c
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/react/fixture.ts
@@ -0,0 +1,31 @@
+export const ordinaryLinkCount = 192
+export const hashLinkCount = 8
+export const serverUrl = '/teams/team-7/items/item-42?view=summary'
+export const clientUrl = `${serverUrl}#details`
+
+export interface Diagnostics {
+ beforeLoads: number
+ loaders: number
+ mounted: boolean
+ clicks: number
+ ordinaryRenders: number
+ hashRenders: number
+ countRenders: boolean
+}
+
+export function createDiagnostics(countRenders = false): Diagnostics {
+ return {
+ beforeLoads: 0,
+ loaders: 0,
+ mounted: false,
+ clicks: 0,
+ ordinaryRenders: 0,
+ hashRenders: 0,
+ countRenders,
+ }
+}
+
+export interface FixtureArtifact {
+ html: string
+ scripts: Array
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/react/generate-fixture.mjs b/benchmarks/client-nav/scenarios/hydration/react/generate-fixture.mjs
new file mode 100644
index 0000000000..fbc67c5a08
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/react/generate-fixture.mjs
@@ -0,0 +1,23 @@
+import assert from 'node:assert/strict'
+import { writeFile } from 'node:fs/promises'
+import { JSDOM } from 'jsdom'
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('Generate the hydration fixture in production mode')
+}
+const { renderFixture } = await import('./dist/server/server.js')
+const html = await renderFixture()
+const dom = new JSDOM(html)
+try {
+ const scriptElements = [...dom.window.document.querySelectorAll('script')]
+ assert.ok(scriptElements.length > 0)
+ assert.ok(scriptElements.every((script) => !script.src))
+ const scripts = scriptElements.map((script) => script.textContent)
+ assert.ok(scripts.some((script) => script.includes('$_TSR')))
+ await writeFile(
+ new URL('./dist/fixture.json', import.meta.url),
+ JSON.stringify({ html, scripts }),
+ )
+} finally {
+ dom.window.close()
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/react/hydration.test.ts b/benchmarks/client-nav/scenarios/hydration/react/hydration.test.ts
new file mode 100644
index 0000000000..7e466cbaed
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/react/hydration.test.ts
@@ -0,0 +1,93 @@
+import { expect, test } from 'vitest'
+import { hashLinkCount, ordinaryLinkCount } from './fixture'
+import { setup } from './setup'
+import { settleHydration } from './settle'
+
+const turn = () => new Promise((resolve) => setImmediate(resolve))
+
+test('restores data and context into fresh DOMs and includes follow-up renders', async () => {
+ const scenario = setup({ countRenders: true })
+ const schedulerTasks = new Set()
+ for (let iteration = 0; iteration < 3; iteration++) {
+ await scenario.before()
+ try {
+ expect(scenario.snapshot().diagnostics.mounted).toBe(false)
+ expect(scenario.snapshot().matches).toBeUndefined()
+ await scenario.run()
+ schedulerTasks.add(scenario.schedulerTasks())
+ const completed = scenario.snapshot()
+ // Supports both main's extra Link update and the optimized snapshot.
+ expect([ordinaryLinkCount, ordinaryLinkCount * 2]).toContain(
+ completed.diagnostics.ordinaryRenders,
+ )
+ expect(completed.diagnostics.hashRenders).toBeGreaterThanOrEqual(
+ hashLinkCount + hashLinkCount / 2,
+ )
+ for (let index = 0; index < 4; index++) {
+ await turn()
+ }
+ expect(scenario.snapshot()).toEqual(completed)
+ await expect(scenario.run()).rejects.toThrow('newly prepared sample')
+ } finally {
+ await scenario.after()
+ }
+ }
+ // React yields on its pinned clock, never on wall time spent hydrating.
+ expect(schedulerTasks.size).toBe(1)
+})
+
+test('rejects an empty measurement and still releases its sample', async () => {
+ const scenario = setup()
+ await scenario.before()
+ await expect(scenario.after()).rejects.toThrow(
+ 'Hydration sample was not completed',
+ )
+ await scenario.before()
+ try {
+ await scenario.run()
+ } finally {
+ await scenario.after()
+ }
+})
+
+test('waits for a commit and scheduler work lasting more than 100 turns', async () => {
+ let committed = false
+ const commit = (async () => {
+ for (let index = 0; index < 150; index++) {
+ await turn()
+ }
+ committed = true
+ })()
+ let remainingCallbacks = 150
+ await settleHydration(
+ commit,
+ () => {
+ expect(committed).toBe(true)
+ return remainingCallbacks-- <= 0
+ },
+ () => 'delayed commit',
+ )
+ expect(remainingCallbacks).toBeLessThan(0)
+})
+
+test('retains a watchdog for a commit that never completes', async () => {
+ await expect(
+ settleHydration(
+ new Promise(() => {}),
+ () => true,
+ () => 'commit pending',
+ 10,
+ ),
+ ).rejects.toThrow('Hydration did not settle within 10ms: commit pending')
+})
+
+test('retains a watchdog when scheduler work never becomes idle', async () => {
+ await expect(
+ settleHydration(
+ Promise.resolve(),
+ () => false,
+ () => 'callbacks pending',
+ 10,
+ ),
+ ).rejects.toThrow('Hydration did not settle within 10ms: callbacks pending')
+})
diff --git a/benchmarks/client-nav/scenarios/hydration/react/project.json b/benchmarks/client-nav/scenarios/hydration/react/project.json
new file mode 100644
index 0000000000..ca23838c0f
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/react/project.json
@@ -0,0 +1,40 @@
+{
+ "name": "@benchmarks/client-nav-hydration-react",
+ "projectType": "application",
+ "targets": {
+ "build:client": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": [
+ { "projects": ["@tanstack/react-router"], "target": "build" }
+ ],
+ "options": {
+ "command": "NODE_ENV=production vite build --config {projectRoot}/vite.server.config.ts && NODE_ENV=production node {projectRoot}/generate-fixture.mjs && NODE_ENV=production vite build --config {projectRoot}/vite.config.ts"
+ }
+ },
+ "test:unit": {
+ "executor": "nx:run-commands",
+ "dependsOn": ["build:client"],
+ "options": {
+ "command": "vitest run --config ./scenarios/hydration/react/vite.config.ts",
+ "cwd": "benchmarks/client-nav"
+ }
+ },
+ "test:perf": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": ["build:client"],
+ "options": {
+ "command": "NODE_ENV=production vitest bench --mode benchmark --run --config ./scenarios/hydration/react/vite.config.ts",
+ "cwd": "benchmarks/client-nav"
+ }
+ },
+ "test:types:client": {
+ "executor": "nx:run-commands",
+ "dependsOn": [
+ { "projects": ["@tanstack/react-router"], "target": "build" }
+ ],
+ "options": { "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" }
+ }
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/react/settle.ts b/benchmarks/client-nav/scenarios/hydration/react/settle.ts
new file mode 100644
index 0000000000..cc4c09a72d
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/react/settle.ts
@@ -0,0 +1,35 @@
+const turn = () => new Promise((resolve) => setImmediate(resolve))
+
+export async function settleHydration(
+ committed: Promise,
+ isIdle: () => boolean,
+ describeProgress: () => string,
+ timeoutMs = 60_000,
+) {
+ let timeoutError: Error | undefined
+ let watchdog: ReturnType | undefined
+ const timeout = new Promise((_, reject) => {
+ watchdog = setTimeout(() => {
+ timeoutError = new Error(
+ `Hydration did not settle within ${timeoutMs}ms: ${describeProgress()}`,
+ )
+ reject(timeoutError)
+ }, timeoutMs)
+ })
+ try {
+ // Concurrent hydration can need many more scheduler turns under CPU
+ // instrumentation. Await its commit instead of limiting successful work
+ // to an arbitrary number of event-loop polls.
+ await Promise.race([committed, timeout])
+ let idleTurns = 0
+ while (idleTurns < 2) {
+ await turn()
+ if (timeoutError) {
+ throw timeoutError
+ }
+ idleTurns = isIdle() ? idleTurns + 1 : 0
+ }
+ } finally {
+ clearTimeout(watchdog)
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/react/setup.ts b/benchmarks/client-nav/scenarios/hydration/react/setup.ts
new file mode 100644
index 0000000000..7c588af3fd
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/react/setup.ts
@@ -0,0 +1,316 @@
+import assert from 'node:assert/strict'
+import { readFileSync } from 'node:fs'
+import { fileURLToPath } from 'node:url'
+import { Script } from 'node:vm'
+import { JSDOM, VirtualConsole } from 'jsdom'
+import { clientUrl, hashLinkCount, ordinaryLinkCount } from './fixture'
+import { settleHydration } from './settle'
+import type { FixtureArtifact } from './fixture'
+import type * as Client from './src/client'
+
+type ClientApp = typeof Client
+const turn = () => new Promise((resolve) => setImmediate(resolve))
+
+// React's scheduler ends a time slice once performance.now() has advanced 5 ms.
+// Under CodSpeed's CPU simulation the wall clock advances much further per
+// instruction, by a runner-dependent factor, so real time turned identical
+// samples into different numbers of yields, scheduler tasks and event-loop
+// turns. With a frozen clock React yields only to paint after a commit, as on
+// a fast host. 1 s is past React's initial 300 ms fallback throttle. Only the
+// window's performance clock is pinned: Date.now(), which the Router uses for
+// match timestamps, is unchanged.
+const schedulerTime = 1_000
+
+export function setup({ countRenders = false } = {}) {
+ // Compile once, outside measurement. Evaluation below creates fresh objects
+ // in each window's realm; neither the payload nor module state is reused.
+ const artifact: FixtureArtifact = JSON.parse(
+ readFileSync(new URL('./dist/fixture.json', import.meta.url), 'utf8'),
+ )
+ const clientPath = new URL('./dist/client/client.js', import.meta.url)
+ const clientScript = new Script(readFileSync(clientPath, 'utf8'), {
+ filename: fileURLToPath(clientPath),
+ })
+ const bootstrapScripts = artifact.scripts.map(
+ (source, index) =>
+ new Script(source, {
+ filename: `hydration-bootstrap-${index}.js`,
+ }),
+ )
+ let current: Awaited> | undefined
+
+ async function prepare() {
+ const errors: Array = []
+ const virtualConsole = new VirtualConsole()
+ virtualConsole.on('jsdomError', (error) => errors.push(String(error)))
+ virtualConsole.on('error', (...args) =>
+ errors.push(args.map(String).join(' ')),
+ )
+ const dom = new JSDOM(artifact.html, {
+ url: `http://localhost${clientUrl}`,
+ runScripts: 'outside-only',
+ virtualConsole,
+ })
+ const immediates = new Set()
+ const scheduler = { tasks: 0 }
+ try {
+ Object.assign(dom.window, {
+ TextEncoder,
+ TextDecoder,
+ ReadableStream,
+ WritableStream,
+ TransformStream,
+ // Let React's production scheduler use the same task-turn primitive as
+ // the existing Node client benchmarks, without a real-delay timer.
+ setImmediate(
+ callback: (...args: Array) => void,
+ ...args: Array
+ ) {
+ scheduler.tasks++
+ const handle = setImmediate(() => {
+ immediates.delete(handle)
+ callback(...args)
+ })
+ immediates.add(handle)
+ return handle
+ },
+ clearImmediate(handle: NodeJS.Immediate) {
+ immediates.delete(handle)
+ clearImmediate(handle)
+ },
+ fetch() {
+ throw new Error('Hydration attempted a network request')
+ },
+ scrollTo() {},
+ })
+ dom.window.performance.now = () => schedulerTime
+ const context = dom.getInternalVMContext()
+ // jsdom has no layout/scroll implementation; only hydration CPU is measured.
+ dom.window.HTMLElement.prototype.scrollIntoView = () => {}
+ clientScript.runInContext(context)
+ const app = (dom.window as unknown as { HydrationBenchmark: ClientApp })
+ .HydrationBenchmark
+ assert.equal(app.serverEnvironment, false)
+ const anchors = Array.from(dom.window.document.querySelectorAll('a'))
+ const scriptElements = Array.from(
+ dom.window.document.querySelectorAll('script'),
+ )
+ const executingScript = { current: null as HTMLScriptElement | null }
+ Object.defineProperty(dom.window.document, 'currentScript', {
+ configurable: true,
+ get: () => executingScript.current,
+ })
+ assert.equal(anchors.length, ordinaryLinkCount + hashLinkCount)
+ const content = dom.window.document.getElementById('hydration-content')
+ assert.ok(content)
+ // Finish jsdom's initial document lifecycle before opening the measure.
+ await turn()
+ assert.equal(dom.window.document.readyState, 'complete')
+ assert.equal(app.ready(), false)
+ return {
+ dom,
+ context,
+ app,
+ anchors,
+ content,
+ scriptElements,
+ executingScript,
+ immediates,
+ scheduler,
+ errors,
+ started: false,
+ completed: false,
+ failed: false,
+ }
+ } catch (error) {
+ for (const handle of immediates) {
+ clearImmediate(handle)
+ }
+ dom.window.close()
+ throw error
+ }
+ }
+
+ async function before() {
+ if (current) {
+ throw new Error('Previous hydration sample was not disposed')
+ }
+ current = await prepare()
+ }
+
+ async function run() {
+ const sample = current
+ if (!sample || sample.started) {
+ throw new Error('Hydration requires a newly prepared sample')
+ }
+ sample.started = true
+ try {
+ // HTML parsing/module evaluation are already done. Payload execution,
+ // router initialization/restoration and React hydration are measured.
+ for (let index = 0; index < bootstrapScripts.length; index++) {
+ // SSR bootstrap scripts remove their own script element after running.
+ sample.executingScript.current = sample.scriptElements[index]!
+ try {
+ bootstrapScripts[index]!.runInContext(sample.context)
+ } finally {
+ sample.executingScript.current = null
+ }
+ }
+ await settleHydration(
+ sample.app.start(countRenders),
+ () => sample.immediates.size === 0,
+ () => {
+ const progress = sample.app.snapshot()
+ return JSON.stringify({
+ diagnostics: progress.diagnostics,
+ errors: [...sample.errors, ...progress.errors],
+ restoredMatches: progress.matches?.length,
+ pendingSchedulerCallbacks: sample.immediates.size,
+ })
+ },
+ )
+ if (sample.errors.length) {
+ throw new Error(sample.errors.join('\n'))
+ }
+ assert.ok(
+ sample.app.ready(),
+ 'Hydration committed without the expected active links',
+ )
+ sample.completed = true
+ } catch (error) {
+ sample.failed = true
+ throw error
+ }
+ }
+
+ function snapshot() {
+ if (!current) {
+ throw new Error('No hydration sample')
+ }
+ // Normalize realm prototypes only for untimed assertions.
+ return JSON.parse(JSON.stringify(current.app.snapshot())) as ReturnType<
+ ClientApp['snapshot']
+ >
+ }
+
+ function schedulerTasks() {
+ if (!current) {
+ throw new Error('No hydration sample')
+ }
+ return current.scheduler.tasks
+ }
+
+ function validate() {
+ assert.ok(current?.started)
+ const { dom, anchors, content, errors } = current
+ const doc = dom.window.document
+ const result = snapshot()
+ assert.deepEqual(errors, [])
+ assert.deepEqual(result.errors, [])
+ assert.equal(result.diagnostics.beforeLoads, 0)
+ assert.equal(result.diagnostics.loaders, 0)
+ assert.equal(result.diagnostics.mounted, true)
+ assert.equal(result.location, clientUrl)
+ assert.equal(result.matches?.length, 3)
+ for (const match of result.matches) {
+ assert.equal(match.status, 'success')
+ assert.deepEqual(match.context.viewer, {
+ id: 'viewer-3',
+ name: 'Ada',
+ role: 'editor',
+ })
+ }
+ assert.deepEqual(result.matches[1]!.context.team, {
+ id: 'team-7',
+ member: 'viewer-3',
+ })
+ assert.deepEqual(result.matches[2]!.context.permissions, { edit: true })
+ assert.deepEqual(result.matches[1]!.loaderData, {
+ title: 'Team team-7',
+ categories: ['open', 'closed'],
+ })
+ const data = result.matches[2]!.loaderData as {
+ owner: string
+ selected: string
+ rows: Array<{
+ id: string
+ label: string
+ details: { score: number; open: boolean }
+ }>
+ }
+ assert.equal(data.owner, 'viewer-3')
+ assert.equal(data.selected, 'item-42')
+ assert.equal(data.rows.length, ordinaryLinkCount)
+ assert.equal(doc.getElementById('hydration-content'), content)
+ assert.equal(doc.querySelectorAll('a').length, anchors.length)
+ assert.equal(doc.getElementById('viewer')?.textContent, 'Ada')
+ assert.equal(doc.getElementById('permission')?.textContent, 'Editable')
+ for (const anchor of anchors) {
+ assert.equal(doc.getElementById(anchor.id), anchor)
+ }
+ for (let index = 0; index < ordinaryLinkCount; index++) {
+ const anchor = doc.getElementById(`ordinary-item-${index}`)!
+ assert.equal(
+ anchor.getAttribute('href'),
+ `/teams/team-7/items/item-${index}?view=summary`,
+ )
+ assert.equal(anchor.textContent, `Item ${index}`)
+ assert.equal(
+ anchor.getAttribute('data-status'),
+ index === 42 ? 'active' : null,
+ )
+ assert.deepEqual(data.rows[index], {
+ id: `item-${index}`,
+ label: `Item ${index}`,
+ details: { score: index * 3, open: index % 2 === 0 },
+ })
+ }
+ for (let index = 0; index < hashLinkCount; index++) {
+ assert.equal(
+ doc.getElementById(`hash-${index}`)?.getAttribute('data-status'),
+ index % 2 === 0 ? 'active' : null,
+ )
+ }
+ doc
+ .getElementById('interactive')!
+ .dispatchEvent(new dom.window.MouseEvent('click', { bubbles: true }))
+ assert.equal(
+ current.app.snapshot().diagnostics.clicks,
+ result.diagnostics.clicks + 1,
+ )
+ }
+
+ async function after() {
+ const sample = current
+ if (!sample) {
+ return
+ }
+ try {
+ if (!sample.failed) {
+ assert.ok(sample.completed, 'Hydration sample was not completed')
+ validate()
+ }
+ } finally {
+ current = undefined
+ try {
+ sample.app.dispose()
+ // Unmount work and its scheduled effects stay outside the measure.
+ await turn()
+ await turn()
+ } finally {
+ for (const handle of sample.immediates) {
+ clearImmediate(handle)
+ }
+ sample.dom.window.close()
+ }
+ }
+ }
+
+ return {
+ before,
+ run,
+ after,
+ snapshot,
+ schedulerTasks,
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/react/speed.bench.ts b/benchmarks/client-nav/scenarios/hydration/react/speed.bench.ts
new file mode 100644
index 0000000000..643877760e
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/react/speed.bench.ts
@@ -0,0 +1,19 @@
+import { test } from 'vitest'
+import { setup } from './setup'
+
+test('client-hydration', async ({ bench }) => {
+ const scenario = setup()
+
+ await bench(
+ 'hydrate restored route state and mixed Links (react)',
+ { beforeEach: scenario.before, afterEach: scenario.after },
+ async () => {
+ await scenario.run()
+ },
+ ).run({
+ time: 5000,
+ warmupTime: 1000,
+ warmupIterations: 20,
+ throws: true,
+ })
+})
diff --git a/benchmarks/client-nav/scenarios/hydration/react/src/app.tsx b/benchmarks/client-nav/scenarios/hydration/react/src/app.tsx
new file mode 100644
index 0000000000..e9797f71fa
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/react/src/app.tsx
@@ -0,0 +1,216 @@
+import { useEffect } from 'react'
+import {
+ HeadContent,
+ Link,
+ Outlet,
+ Scripts,
+ createMemoryHistory,
+ createRootRoute,
+ createRoute,
+ createRouter,
+ useHydrated,
+} from '@tanstack/react-router'
+import {
+ clientUrl,
+ hashLinkCount,
+ ordinaryLinkCount,
+ serverUrl,
+} from '../fixture'
+import type { ReactNode } from 'react'
+import type { Diagnostics } from '../fixture'
+
+export function createFixtureRouter(
+ server: boolean,
+ diagnostics: Diagnostics,
+ onHydrated: () => void = () => {},
+) {
+ function beforeLoad() {
+ diagnostics.beforeLoads++
+ if (!server) {
+ throw new Error('Hydration reran beforeLoad instead of restoring context')
+ }
+ }
+
+ function loader() {
+ diagnostics.loaders++
+ if (!server) {
+ throw new Error('Hydration reran a loader instead of restoring data')
+ }
+ }
+
+ const root = createRootRoute({
+ beforeLoad: () => {
+ beforeLoad()
+ return { viewer: { id: 'viewer-3', name: 'Ada', role: 'editor' } }
+ },
+ head: () => ({
+ meta: [{ charSet: 'utf-8' }, { title: 'Hydration benchmark' }],
+ }),
+ shellComponent: Document,
+ })
+ const team = createRoute({
+ getParentRoute: () => root,
+ path: '/teams/$teamId',
+ beforeLoad: ({ context, params }) => {
+ beforeLoad()
+ return { team: { id: params.teamId, member: context.viewer.id } }
+ },
+ loader: ({ context }) => {
+ loader()
+ return {
+ title: `Team ${context.team.id}`,
+ categories: ['open', 'closed'],
+ }
+ },
+ component: Team,
+ })
+ const items = createRoute({
+ getParentRoute: () => team,
+ path: 'items/$itemId',
+ validateSearch: (search: Record) => ({
+ view: search.view === 'details' ? 'details' : 'summary',
+ }),
+ beforeLoad: ({ context }) => {
+ beforeLoad()
+ return { permissions: { edit: context.viewer.role === 'editor' } }
+ },
+ loader: ({ context, params }) => {
+ loader()
+ return {
+ selected: params.itemId,
+ owner: context.team.member,
+ rows: Array.from({ length: ordinaryLinkCount }, (_, index) => ({
+ id: `item-${index}`,
+ label: `Item ${index}`,
+ details: { score: index * 3, open: index % 2 === 0 },
+ })),
+ }
+ },
+ component: Items,
+ })
+
+ function Document({ children }: { children: ReactNode }) {
+ return (
+
+
+
+
+
+ {children}
+
+
+
+ )
+ }
+
+ function Team() {
+ const context = team.useRouteContext()
+ const data = team.useLoaderData()
+ return (
+
+ {data.title}
+ {context.viewer.name}
+
+
+ )
+ }
+
+ function Items() {
+ const data = items.useLoaderData()
+ const context = items.useRouteContext()
+ useEffect(() => {
+ diagnostics.mounted = true
+ }, [])
+ return (
+ <>
+
+ {context.permissions.edit ? 'Editable' : 'Read only'}
+
+ {
+ diagnostics.clicks++
+ }}
+ >
+ Ready
+
+
+
+ {data.rows.map((row) => (
+
+ {row.id}
+ {row.details.score}
+
+
+ {diagnostics.countRenders
+ ? () => {
+ diagnostics.ordinaryRenders++
+ return row.label
+ }
+ : row.label}
+
+
+
+ ))}
+
+
+
+ {Array.from({ length: hashLinkCount }, (_, index) => (
+
+ {diagnostics.countRenders
+ ? () => {
+ diagnostics.hashRenders++
+ return `Section ${index}`
+ }
+ : `Section ${index}`}
+
+ ))}
+
+
+
+ >
+ )
+ }
+
+ function HydrationComplete() {
+ const hydrated = useHydrated()
+ useEffect(() => {
+ if (hydrated) {
+ onHydrated()
+ }
+ }, [hydrated])
+ return null
+ }
+
+ return createRouter({
+ routeTree: root.addChildren([team.addChildren([items])]),
+ history: createMemoryHistory({
+ initialEntries: [server ? serverUrl : clientUrl],
+ }),
+ isServer: server,
+ scrollRestoration: false,
+ defaultHashScrollIntoView: false,
+ defaultPreload: false,
+ })
+}
+
+declare module '@tanstack/react-router' {
+ interface Register {
+ router: ReturnType
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/react/src/client.tsx b/benchmarks/client-nav/scenarios/hydration/react/src/client.tsx
new file mode 100644
index 0000000000..42c5a5104e
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/react/src/client.tsx
@@ -0,0 +1,83 @@
+import { startTransition } from 'react'
+import { hydrateRoot } from 'react-dom/client'
+import { RouterProvider } from '@tanstack/react-router'
+import { hydrate } from '@tanstack/react-router/ssr/client'
+import { isServer } from '@tanstack/router-core/isServer'
+import { createDiagnostics, hashLinkCount } from '../fixture'
+import { createFixtureRouter } from './app'
+
+export const serverEnvironment = isServer
+let router: ReturnType | undefined
+let root: ReturnType | undefined
+let diagnostics = createDiagnostics()
+const errors: Array = []
+
+export async function start(countRenders = false) {
+ if (router) {
+ throw new Error('A hydration sample must use a fresh client realm')
+ }
+ if (!window.$_TSR?.router) {
+ throw new Error('Missing SSR hydration payload')
+ }
+ diagnostics = createDiagnostics(countRenders)
+ let resolveHydrated!: () => void
+ let rejectHydrated!: (error: unknown) => void
+ const hydrated = new Promise((resolve, reject) => {
+ resolveHydrated = resolve
+ rejectHydrated = reject
+ })
+ router = createFixtureRouter(false, diagnostics, resolveHydrated)
+ // This is the same restoration path used by Start, without a module-cached
+ // RouterClient/StartClient promise or a live server in the worker.
+ await hydrate(router)
+ window.$_TSR.h()
+ startTransition(() => {
+ root = hydrateRoot(document, , {
+ onRecoverableError: (error) => {
+ errors.push(String(error))
+ rejectHydrated(error)
+ },
+ onUncaughtError: (error) => {
+ errors.push(String(error))
+ rejectHydrated(error)
+ },
+ })
+ })
+ await hydrated
+}
+
+export function ready() {
+ if (!diagnostics.mounted) {
+ return false
+ }
+ // Matching hash Links only become active in the follow-up hydration commit.
+ // Ending at the first mount effect would miss the work this scenario targets.
+ for (let index = 0; index < hashLinkCount; index += 2) {
+ if (
+ document.getElementById(`hash-${index}`)?.getAttribute('data-status') !==
+ 'active'
+ ) {
+ return false
+ }
+ }
+ return true
+}
+
+export function snapshot() {
+ const matches = router?.stores.matches.get()
+ return {
+ diagnostics: { ...diagnostics },
+ errors: [...errors],
+ location: router?.stores.location.get().href,
+ matches: matches?.map((match) => ({
+ status: match.status,
+ context: match.context,
+ loaderData: match.loaderData,
+ })),
+ }
+}
+
+export function dispose() {
+ root?.unmount()
+ router?.history.destroy()
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/react/src/server.tsx b/benchmarks/client-nav/scenarios/hydration/react/src/server.tsx
new file mode 100644
index 0000000000..713b0a77f2
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/react/src/server.tsx
@@ -0,0 +1,29 @@
+import {
+ createRequestHandler,
+ defaultStreamHandler,
+} from '@tanstack/react-router/ssr/server'
+import { isServer } from '@tanstack/router-core/isServer'
+import { createDiagnostics, serverUrl } from '../fixture'
+import { createFixtureRouter } from './app'
+
+export async function renderFixture() {
+ if ((isServer as boolean | undefined) !== true) {
+ throw new Error('Fixture generation requires the production server build')
+ }
+ const diagnostics = createDiagnostics()
+ const response = await createRequestHandler({
+ createRouter: () => createFixtureRouter(true, diagnostics),
+ request: new Request(`http://localhost${serverUrl}`),
+ })(defaultStreamHandler)
+ const html = await response.text()
+ if (
+ response.status !== 200 ||
+ diagnostics.beforeLoads !== 3 ||
+ diagnostics.loaders !== 2
+ ) {
+ throw new Error(
+ 'SSR fixture did not execute its beforeLoad and loader functions',
+ )
+ }
+ return html
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/react/tsconfig.json b/benchmarks/client-nav/scenarios/hydration/react/tsconfig.json
new file mode 100644
index 0000000000..23dd08de8b
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/react/tsconfig.json
@@ -0,0 +1,10 @@
+{
+ "extends": "../../../../../tsconfig.json",
+ "compilerOptions": {
+ "jsx": "react-jsx",
+ "jsxImportSource": "react",
+ "allowImportingTsExtensions": true,
+ "types": ["node", "vite/client", "vitest/globals"]
+ },
+ "include": ["./*.ts", "./src/**/*"]
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/react/vite.config.ts b/benchmarks/client-nav/scenarios/hydration/react/vite.config.ts
new file mode 100644
index 0000000000..62ab87115b
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/react/vite.config.ts
@@ -0,0 +1,36 @@
+import { fileURLToPath } from 'node:url'
+import { defineConfig } from 'vitest/config'
+import react from '@vitejs/plugin-react'
+import codspeedPlugin from '@codspeed/vitest-plugin'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
+
+export default defineConfig({
+ root: fileURLToPath(new URL('.', import.meta.url)),
+ define: { 'process.env.NODE_ENV': JSON.stringify('production') },
+ plugins: [
+ !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&
+ codspeedPlugin(),
+ react(),
+ ],
+ resolve: { conditions: ['browser', 'production'] },
+ build: {
+ outDir: './dist/client',
+ emptyOutDir: true,
+ minify: false,
+ lib: {
+ entry: './src/client.tsx',
+ name: 'HydrationBenchmark',
+ formats: ['iife'],
+ fileName: () => 'client.js',
+ },
+ },
+ test: {
+ execArgv: cpuSimulationExecArgv(),
+ name: '@benchmarks/client-nav hydration (react)',
+ watch: false,
+ environment: 'node',
+ isolate: true,
+ include: ['hydration.test.ts'],
+ benchmark: { include: ['speed.bench.ts'] },
+ },
+})
diff --git a/benchmarks/client-nav/scenarios/hydration/react/vite.server.config.ts b/benchmarks/client-nav/scenarios/hydration/react/vite.server.config.ts
new file mode 100644
index 0000000000..fbf6a149b9
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/react/vite.server.config.ts
@@ -0,0 +1,26 @@
+import { fileURLToPath } from 'node:url'
+import { defineConfig } from 'vite'
+import react from '@vitejs/plugin-react'
+
+export default defineConfig({
+ root: fileURLToPath(new URL('.', import.meta.url)),
+ define: { 'process.env.NODE_ENV': JSON.stringify('production') },
+ plugins: [react()],
+ resolve: { conditions: ['node', 'production'] },
+ ssr: { noExternal: true },
+ build: {
+ ssr: true,
+ outDir: './dist/server',
+ emptyOutDir: true,
+ minify: false,
+ lib: {
+ entry: './src/server.tsx',
+ formats: ['es'],
+ fileName: () => 'server.js',
+ },
+ rolldownOptions: {
+ platform: 'node',
+ external: [/^node:/, /^react(?:\/|$)/, /^react-dom(?:\/|$)/],
+ },
+ },
+})
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/fixture.ts b/benchmarks/client-nav/scenarios/hydration/solid/fixture.ts
new file mode 100644
index 0000000000..4c86d0e2f4
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/solid/fixture.ts
@@ -0,0 +1,35 @@
+export {
+ clientUrl,
+ hashLinkCount,
+ ordinaryLinkCount,
+ serverUrl,
+} from '../react/fixture'
+export type { FixtureArtifact } from '../react/fixture'
+
+export interface Diagnostics {
+ beforeLoads: number
+ loaders: number
+ mounted: boolean
+ rendered: number
+ clicks: number
+ countUpdates: boolean
+ ordinaryEvaluations: number
+ hashEvaluations: number
+ initialHashStates: Array
+ hashStates: Array
+}
+
+export function createDiagnostics(countUpdates = false): Diagnostics {
+ return {
+ beforeLoads: 0,
+ loaders: 0,
+ mounted: false,
+ rendered: 0,
+ clicks: 0,
+ countUpdates,
+ ordinaryEvaluations: 0,
+ hashEvaluations: 0,
+ initialHashStates: [],
+ hashStates: [],
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/generate-fixture.mjs b/benchmarks/client-nav/scenarios/hydration/solid/generate-fixture.mjs
new file mode 100644
index 0000000000..63647e1be7
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/solid/generate-fixture.mjs
@@ -0,0 +1,30 @@
+import assert from 'node:assert/strict'
+import { writeFile } from 'node:fs/promises'
+import { JSDOM } from 'jsdom'
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('Generate the hydration fixture in production mode')
+}
+const { renderFixture } = await import('./dist/server/server.js')
+const html = await renderFixture()
+const dom = new JSDOM(html)
+try {
+ const doc = dom.window.document
+ const scriptElements = [...doc.querySelectorAll('script')]
+ assert.ok(scriptElements.length > 0)
+ assert.ok(scriptElements.every((script) => !script.src))
+ const scripts = scriptElements.map((script) => script.textContent)
+ assert.ok(scripts.some((script) => script.includes('$_TSR')))
+ assert.ok(scripts.some((script) => script.includes('_$HY')))
+ assert.ok(doc.documentElement.hasAttribute('data-hk'))
+ assert.ok(doc.getElementById('hydration-content')?.hasAttribute('data-hk'))
+ assert.ok(
+ [...doc.querySelectorAll('a')].every((a) => a.hasAttribute('data-hk')),
+ )
+ await writeFile(
+ new URL('./dist/fixture.json', import.meta.url),
+ JSON.stringify({ html, scripts }),
+ )
+} finally {
+ dom.window.close()
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/hydration.test.ts b/benchmarks/client-nav/scenarios/hydration/solid/hydration.test.ts
new file mode 100644
index 0000000000..4e5f3208ca
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/solid/hydration.test.ts
@@ -0,0 +1,81 @@
+import { expect, test } from 'vitest'
+import { hashLinkCount, ordinaryLinkCount } from './fixture'
+import { setup } from './setup'
+
+const turn = () => new Promise((resolve) => setImmediate(resolve))
+
+test('restores fresh DOMs and route state and completes hash-link reactivity', async () => {
+ const scenario = setup({ countUpdates: true })
+ let previous: ReturnType | undefined
+ for (let iteration = 0; iteration < 3; iteration++) {
+ await scenario.before()
+ try {
+ const initial = scenario.snapshot()
+ expect(initial.matches).toBeUndefined()
+ expect(initial.diagnostics.mounted).toBe(false)
+ expect(initial.diagnostics.rendered).toBe(0)
+ expect(initial.diagnostics.clicks).toBe(0)
+ expect(initial.diagnostics.ordinaryEvaluations).toBe(0)
+ expect(initial.diagnostics.hashEvaluations).toBe(0)
+ expect(initial.diagnostics.initialHashStates).toEqual([])
+ await scenario.run()
+ const completed = scenario.snapshot()
+ expect(completed.diagnostics.ordinaryEvaluations).toBeGreaterThanOrEqual(
+ ordinaryLinkCount,
+ )
+ expect(completed.diagnostics.initialHashStates).toEqual(
+ Array.from({ length: hashLinkCount }, () => false),
+ )
+ expect(completed.diagnostics.hashStates).toEqual(
+ Array.from({ length: hashLinkCount }, (_, index) => index % 2 === 0),
+ )
+ expect(completed.diagnostics.hashEvaluations).toBeGreaterThanOrEqual(
+ hashLinkCount + hashLinkCount / 2,
+ )
+ expect(completed.hydrating).toBe(false)
+ for (let index = 0; index < 4; index++) {
+ await turn()
+ }
+ expect(scenario.snapshot()).toEqual(completed)
+ if (previous) {
+ expect(completed).toEqual(previous)
+ }
+ previous = completed
+ await expect(scenario.run()).rejects.toThrow('newly prepared sample')
+ } finally {
+ // Untimed assertions include DOM identity, all restored data/context,
+ // native event handling, and the absence of hydration diagnostics.
+ await scenario.after()
+ }
+ }
+})
+
+test('prepares every sample without counting diagnostics', async () => {
+ const scenario = setup()
+ for (let iteration = 0; iteration < 2; iteration++) {
+ await scenario.before()
+ try {
+ expect(scenario.snapshot().diagnostics.mounted).toBe(false)
+ expect(scenario.snapshot().diagnostics.clicks).toBe(0)
+ await scenario.run()
+ expect(scenario.snapshot().diagnostics.hashEvaluations).toBe(0)
+ } finally {
+ await scenario.after()
+ }
+ }
+})
+
+test('rejects an empty measurement and still releases its sample', async () => {
+ const scenario = setup()
+ await scenario.before()
+ await expect(scenario.after()).rejects.toThrow(
+ 'Hydration sample was not completed',
+ )
+ await scenario.before()
+ try {
+ await expect(scenario.before()).rejects.toThrow('was not disposed')
+ await scenario.run()
+ } finally {
+ await scenario.after()
+ }
+})
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/project.json b/benchmarks/client-nav/scenarios/hydration/solid/project.json
new file mode 100644
index 0000000000..1fa162771b
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/solid/project.json
@@ -0,0 +1,40 @@
+{
+ "name": "@benchmarks/client-nav-hydration-solid",
+ "projectType": "application",
+ "targets": {
+ "build:client": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": [
+ { "projects": ["@tanstack/solid-router"], "target": "build" }
+ ],
+ "options": {
+ "command": "NODE_ENV=production vite build --config {projectRoot}/vite.server.config.ts && NODE_ENV=production node {projectRoot}/generate-fixture.mjs && NODE_ENV=production vite build --config {projectRoot}/vite.config.ts"
+ }
+ },
+ "test:unit": {
+ "executor": "nx:run-commands",
+ "dependsOn": ["build:client"],
+ "options": {
+ "command": "vitest run --config ./scenarios/hydration/solid/vite.config.ts",
+ "cwd": "benchmarks/client-nav"
+ }
+ },
+ "test:perf": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": ["build:client"],
+ "options": {
+ "command": "NODE_ENV=production vitest bench --mode benchmark --run --config ./scenarios/hydration/solid/vite.config.ts",
+ "cwd": "benchmarks/client-nav"
+ }
+ },
+ "test:types:client": {
+ "executor": "nx:run-commands",
+ "dependsOn": [
+ { "projects": ["@tanstack/solid-router"], "target": "build" }
+ ],
+ "options": { "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" }
+ }
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/setup.ts b/benchmarks/client-nav/scenarios/hydration/solid/setup.ts
new file mode 100644
index 0000000000..ebdbc8e9b2
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/solid/setup.ts
@@ -0,0 +1,326 @@
+import assert from 'node:assert/strict'
+import { readFileSync } from 'node:fs'
+import { fileURLToPath } from 'node:url'
+import { Script } from 'node:vm'
+import { JSDOM, VirtualConsole } from 'jsdom'
+import { clientUrl, hashLinkCount, ordinaryLinkCount } from './fixture'
+import type { FixtureArtifact } from './fixture'
+import type * as Client from './src/client'
+
+type ClientApp = typeof Client
+const turn = () => new Promise((resolve) => setImmediate(resolve))
+const maxSettleTurns = 100
+
+export function setup({ countUpdates = false } = {}) {
+ // Compile once, outside measurement; evaluate the entire production bundle
+ // anew in every window, including Solid's module-level hydration state.
+ const artifact: FixtureArtifact = JSON.parse(
+ readFileSync(new URL('./dist/fixture.json', import.meta.url), 'utf8'),
+ )
+ const clientPath = new URL('./dist/client/client.js', import.meta.url)
+ const clientScript = new Script(readFileSync(clientPath, 'utf8'), {
+ filename: fileURLToPath(clientPath),
+ })
+ const bootstrapScripts = artifact.scripts.map(
+ (source, index) =>
+ new Script(source, {
+ filename: `solid-hydration-bootstrap-${index}.js`,
+ }),
+ )
+ let current: Awaited> | undefined
+
+ async function prepare() {
+ const errors: Array = []
+ const virtualConsole = new VirtualConsole()
+ virtualConsole.on('jsdomError', (error) => errors.push(String(error)))
+ for (const event of ['error', 'warn'] as const) {
+ virtualConsole.on(event, (...args) =>
+ errors.push(args.map(String).join(' ')),
+ )
+ }
+ const dom = new JSDOM(artifact.html, {
+ url: `http://localhost${clientUrl}`,
+ runScripts: 'outside-only',
+ virtualConsole,
+ })
+ const immediates = new Set()
+ try {
+ Object.assign(dom.window, {
+ TextEncoder,
+ TextDecoder,
+ ReadableStream,
+ WritableStream,
+ TransformStream,
+ setImmediate(
+ callback: (...args: Array) => void,
+ ...args: Array
+ ) {
+ const handle = setImmediate(() => {
+ immediates.delete(handle)
+ callback(...args)
+ })
+ immediates.add(handle)
+ return handle
+ },
+ clearImmediate(handle: NodeJS.Immediate) {
+ immediates.delete(handle)
+ clearImmediate(handle)
+ },
+ fetch() {
+ throw new Error('Hydration attempted a network request')
+ },
+ scrollTo() {},
+ })
+ dom.window.addEventListener('unhandledrejection', (event) => {
+ errors.push(String(event.reason))
+ })
+ dom.window.HTMLElement.prototype.scrollIntoView = () => {}
+ const context = dom.getInternalVMContext()
+ clientScript.runInContext(context)
+ const app = (dom.window as unknown as { HydrationBenchmark: ClientApp })
+ .HydrationBenchmark
+ assert.equal(app.serverEnvironment, false)
+ assert.equal(app.solidServerEnvironment, false)
+ const doc = dom.window.document
+ const anchors = Array.from(doc.querySelectorAll('a'))
+ const scriptElements = Array.from(doc.querySelectorAll('script'))
+ assert.equal(scriptElements.length, bootstrapScripts.length)
+ const executingScript = { current: null as HTMLScriptElement | null }
+ Object.defineProperty(doc, 'currentScript', {
+ configurable: true,
+ get: () => executingScript.current,
+ })
+ assert.equal(anchors.length, ordinaryLinkCount + hashLinkCount)
+ const content = doc.getElementById('hydration-content')
+ assert.ok(content)
+ assert.ok(content.hasAttribute('data-hk'))
+ assert.ok(anchors.every((anchor) => anchor.hasAttribute('data-hk')))
+ for (let index = 0; index < hashLinkCount; index++) {
+ assert.equal(
+ doc.getElementById(`hash-${index}`)?.getAttribute('data-status'),
+ null,
+ )
+ }
+ // Production Solid can fall back to templates for missing hydration keys.
+ // Retain every workload element, not only the parent and the anchors.
+ const elements = Array.from(content.querySelectorAll('*'))
+ const documentElement = doc.documentElement
+ await turn()
+ assert.equal(doc.readyState, 'complete')
+ assert.equal(app.ready(), false)
+ assert.deepEqual(errors, [])
+ return {
+ dom,
+ context,
+ app,
+ anchors,
+ content,
+ elements,
+ documentElement,
+ scriptElements,
+ executingScript,
+ immediates,
+ errors,
+ started: false,
+ completed: false,
+ failed: false,
+ }
+ } catch (error) {
+ for (const handle of immediates) {
+ clearImmediate(handle)
+ }
+ dom.window.close()
+ throw error
+ }
+ }
+
+ async function before() {
+ if (current) {
+ throw new Error('Previous hydration sample was not disposed')
+ }
+ current = await prepare()
+ }
+
+ async function run() {
+ const sample = current
+ if (!sample || sample.started) {
+ throw new Error('Hydration requires a newly prepared sample')
+ }
+ sample.started = true
+ try {
+ // Parsing/evaluation are done. Execute both native Solid bootstrap and
+ // Router payload, then create/restore the router and hydrate the DOM.
+ for (let index = 0; index < bootstrapScripts.length; index++) {
+ // Router scripts remove document.currentScript. Keep the original
+ // script nodes and order, including Solid's bootstrap and markers.
+ sample.executingScript.current = sample.scriptElements[index]!
+ try {
+ bootstrapScripts[index]!.runInContext(sample.context)
+ } finally {
+ sample.executingScript.current = null
+ }
+ }
+ await sample.app.start(countUpdates)
+ let idleTurns = 0
+ for (let index = 0; index < maxSettleTurns; index++) {
+ await turn()
+ if (sample.errors.length) {
+ throw new Error(sample.errors.join('\n'))
+ }
+ if (sample.app.ready() && sample.immediates.size === 0) {
+ if (++idleTurns === 2) {
+ sample.completed = true
+ return
+ }
+ } else {
+ idleTurns = 0
+ }
+ }
+ throw new Error(
+ `Hydration did not settle: ${JSON.stringify(sample.app.snapshot())}`,
+ )
+ } catch (error) {
+ sample.failed = true
+ throw error
+ }
+ }
+
+ function snapshot() {
+ if (!current) {
+ throw new Error('No hydration sample')
+ }
+ // Normalize realm prototypes only for untimed assertions.
+ return JSON.parse(JSON.stringify(current.app.snapshot())) as ReturnType<
+ ClientApp['snapshot']
+ >
+ }
+
+ function validate() {
+ assert.ok(current?.started)
+ const { dom, anchors, content, elements, documentElement, errors } = current
+ const doc = dom.window.document
+ const result = snapshot()
+ assert.deepEqual(errors, [])
+ assert.equal(result.diagnostics.beforeLoads, 0)
+ assert.equal(result.diagnostics.loaders, 0)
+ assert.equal(result.diagnostics.mounted, true)
+ assert.ok(result.diagnostics.rendered > 0)
+ assert.equal(result.hydrating, false)
+ assert.equal(result.location, clientUrl)
+ assert.equal(result.resolvedLocation, clientUrl)
+ assert.equal(result.matches?.length, 3)
+ for (const match of result.matches) {
+ assert.equal(match.status, 'success')
+ assert.deepEqual(match.context.viewer, {
+ id: 'viewer-3',
+ name: 'Ada',
+ role: 'editor',
+ })
+ }
+ const teamContext = { id: 'team-7', member: 'viewer-3' }
+ assert.deepEqual(result.matches[1]!.context.team, teamContext)
+ assert.deepEqual(result.matches[2]!.context.team, teamContext)
+ assert.deepEqual(result.matches[2]!.context.permissions, { edit: true })
+ assert.deepEqual(result.matches[1]!.loaderData, {
+ title: 'Team team-7',
+ categories: ['open', 'closed'],
+ })
+ const data = result.matches[2]!.loaderData as {
+ owner: string
+ selected: string
+ rows: Array<{
+ id: string
+ label: string
+ details: { score: number; open: boolean }
+ }>
+ }
+ assert.equal(data.owner, 'viewer-3')
+ assert.equal(data.selected, 'item-42')
+ assert.equal(data.rows.length, ordinaryLinkCount)
+ assert.equal(doc.documentElement, documentElement)
+ assert.equal(doc.getElementById('hydration-content'), content)
+ const hydratedElements = Array.from(content.querySelectorAll('*'))
+ assert.equal(hydratedElements.length, elements.length)
+ elements.forEach((element, index) => {
+ assert.equal(hydratedElements[index], element)
+ })
+ assert.equal(doc.querySelectorAll('a').length, anchors.length)
+ assert.equal(doc.title, 'Hydration benchmark')
+ assert.equal(content.querySelector('h1')?.textContent, 'Team team-7')
+ assert.equal(doc.getElementById('viewer')?.textContent, 'Ada')
+ assert.equal(doc.getElementById('permission')?.textContent, 'Editable')
+ for (const anchor of anchors) {
+ assert.equal(doc.getElementById(anchor.id), anchor)
+ }
+ for (let index = 0; index < ordinaryLinkCount; index++) {
+ const anchor = doc.getElementById(`ordinary-item-${index}`)!
+ assert.equal(
+ anchor.getAttribute('href'),
+ `/teams/team-7/items/item-${index}?view=summary`,
+ )
+ assert.equal(anchor.textContent, `Item ${index}`)
+ assert.equal(
+ anchor.getAttribute('data-status'),
+ index === 42 ? 'active' : null,
+ )
+ assert.deepEqual(data.rows[index], {
+ id: `item-${index}`,
+ label: `Item ${index}`,
+ details: { score: index * 3, open: index % 2 === 0 },
+ })
+ }
+ for (let index = 0; index < hashLinkCount; index++) {
+ const anchor = doc.getElementById(`hash-${index}`)!
+ assert.equal(
+ anchor.getAttribute('data-status'),
+ index % 2 === 0 ? 'active' : null,
+ )
+ assert.equal(
+ anchor.getAttribute('href'),
+ `/teams/team-7/items/item-42?view=summary#${index % 2 === 0 ? 'details' : 'other'}`,
+ )
+ assert.equal(anchor.textContent, `Section ${index}`)
+ }
+ assert.equal(result.diagnostics.clicks, 0)
+ doc
+ .getElementById('interactive')!
+ .dispatchEvent(new dom.window.MouseEvent('click', { bubbles: true }))
+ assert.equal(current.app.snapshot().diagnostics.clicks, 1)
+ assert.deepEqual(errors, [])
+ }
+
+ async function after() {
+ const sample = current
+ if (!sample) {
+ return
+ }
+ try {
+ if (!sample.failed) {
+ assert.ok(sample.completed, 'Hydration sample was not completed')
+ validate()
+ }
+ } finally {
+ current = undefined
+ try {
+ sample.app.dispose()
+ await turn()
+ await turn()
+ if (!sample.failed) {
+ assert.deepEqual(sample.errors, [])
+ }
+ } finally {
+ for (const handle of sample.immediates) {
+ clearImmediate(handle)
+ }
+ sample.dom.window.close()
+ }
+ }
+ }
+
+ return {
+ before,
+ run,
+ after,
+ snapshot,
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/hydration/solid/speed.bench.ts
new file mode 100644
index 0000000000..b386cb8215
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/solid/speed.bench.ts
@@ -0,0 +1,19 @@
+import { test } from 'vitest'
+import { setup } from './setup'
+
+test('client-hydration', async ({ bench }) => {
+ const scenario = setup()
+
+ await bench(
+ 'hydrate restored route state and mixed Links (solid)',
+ { beforeEach: scenario.before, afterEach: scenario.after },
+ async () => {
+ await scenario.run()
+ },
+ ).run({
+ time: 5000,
+ warmupTime: 1000,
+ warmupIterations: 20,
+ throws: true,
+ })
+})
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/src/app.tsx b/benchmarks/client-nav/scenarios/hydration/solid/src/app.tsx
new file mode 100644
index 0000000000..cb772d6b5b
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/solid/src/app.tsx
@@ -0,0 +1,213 @@
+import { For, onMount } from 'solid-js'
+import { HydrationScript } from 'solid-js/web'
+import {
+ HeadContent,
+ Link,
+ Outlet,
+ Scripts,
+ createMemoryHistory,
+ createRootRoute,
+ createRoute,
+ createRouter,
+} from '@tanstack/solid-router'
+import {
+ clientUrl,
+ hashLinkCount,
+ ordinaryLinkCount,
+ serverUrl,
+} from '../fixture'
+import type { JSX } from 'solid-js'
+import type { Diagnostics } from '../fixture'
+
+export function createFixtureRouter(server: boolean, diagnostics: Diagnostics) {
+ function beforeLoad() {
+ diagnostics.beforeLoads++
+ if (!server) {
+ throw new Error('Hydration reran beforeLoad instead of restoring context')
+ }
+ }
+
+ function loader() {
+ diagnostics.loaders++
+ if (!server) {
+ throw new Error('Hydration reran a loader instead of restoring data')
+ }
+ }
+
+ const root = createRootRoute({
+ beforeLoad: () => {
+ beforeLoad()
+ return { viewer: { id: 'viewer-3', name: 'Ada', role: 'editor' } }
+ },
+ head: () => ({
+ meta: [{ charset: 'utf-8' }, { title: 'Hydration benchmark' }],
+ }),
+ shellComponent: Document,
+ })
+ const team = createRoute({
+ getParentRoute: () => root,
+ path: '/teams/$teamId',
+ beforeLoad: ({ context, params }) => {
+ beforeLoad()
+ return { team: { id: params.teamId, member: context.viewer.id } }
+ },
+ loader: ({ context }) => {
+ loader()
+ return {
+ title: `Team ${context.team.id}`,
+ categories: ['open', 'closed'],
+ }
+ },
+ component: Team,
+ })
+ const items = createRoute({
+ getParentRoute: () => team,
+ path: 'items/$itemId',
+ validateSearch: (search: Record) => ({
+ view: search.view === 'details' ? 'details' : 'summary',
+ }),
+ beforeLoad: ({ context }) => {
+ beforeLoad()
+ return { permissions: { edit: context.viewer.role === 'editor' } }
+ },
+ loader: ({ context, params }) => {
+ loader()
+ return {
+ selected: params.itemId,
+ owner: context.team.member,
+ rows: Array.from({ length: ordinaryLinkCount }, (_, index) => ({
+ id: `item-${index}`,
+ label: `Item ${index}`,
+ details: { score: index * 3, open: index % 2 === 0 },
+ })),
+ }
+ },
+ component: Items,
+ })
+
+ function Document(props: { children: JSX.Element }) {
+ return (
+
+
+
+
+
+
+ {props.children}
+
+
+
+ )
+ }
+
+ function Team() {
+ const context = team.useRouteContext()
+ const data = team.useLoaderData()
+ return (
+
+ {data().title}
+ {context().viewer.name}
+
+
+ )
+ }
+
+ function Items() {
+ const data = items.useLoaderData()
+ const context = items.useRouteContext()
+ onMount(() => {
+ diagnostics.mounted = true
+ })
+ return (
+ <>
+
+ {context().permissions.edit ? 'Editable' : 'Read only'}
+
+ {
+ diagnostics.clicks++
+ }}
+ >
+ Ready
+
+
+
+
+ {(row) => (
+
+ {row.id}
+ {row.details.score}
+
+
+ {diagnostics.countUpdates
+ ? (state) => {
+ // Read the getter so this unit-only probe observes
+ // Link reactivity, rather than component execution.
+ void state.isActive
+ diagnostics.ordinaryEvaluations++
+ return row.label
+ }
+ : row.label}
+
+
+
+ )}
+
+
+
+
+ index)}
+ >
+ {(index) => (
+
+ {diagnostics.countUpdates
+ ? (state) => {
+ const active = state.isActive
+ diagnostics.hashEvaluations++
+ diagnostics.initialHashStates[index] ??= active
+ diagnostics.hashStates[index] = active
+ return `Section ${index}`
+ }
+ : `Section ${index}`}
+
+ )}
+
+
+
+ >
+ )
+ }
+
+ return createRouter({
+ routeTree: root.addChildren([team.addChildren([items])]),
+ history: createMemoryHistory({
+ initialEntries: [server ? serverUrl : clientUrl],
+ }),
+ isServer: server,
+ scrollRestoration: false,
+ defaultHashScrollIntoView: false,
+ defaultPreload: false,
+ })
+}
+
+declare module '@tanstack/solid-router' {
+ interface Register {
+ router: ReturnType
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/src/client.tsx b/benchmarks/client-nav/scenarios/hydration/solid/src/client.tsx
new file mode 100644
index 0000000000..ef0f5268d6
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/solid/src/client.tsx
@@ -0,0 +1,91 @@
+import { sharedConfig } from 'solid-js'
+import { hydrate as hydrateDOM, isServer as solidIsServer } from 'solid-js/web'
+import { RouterProvider } from '@tanstack/solid-router'
+import { hydrate } from '@tanstack/router-core/ssr/client'
+import { isServer } from '@tanstack/router-core/isServer'
+import { createDiagnostics, hashLinkCount } from '../fixture'
+import { createFixtureRouter } from './app'
+
+export const serverEnvironment = isServer
+export const solidServerEnvironment = solidIsServer
+let router: ReturnType | undefined
+let disposeRoot: (() => void) | undefined
+let unsubscribe: (() => void) | undefined
+let diagnostics = createDiagnostics()
+
+type HydrationWindow = Window & {
+ _$HY?: { done?: boolean; events?: Array; r: object }
+}
+
+export async function start(countUpdates = false) {
+ if (router) {
+ throw new Error('A hydration sample must use a fresh client realm')
+ }
+ if (!window.$_TSR?.router) {
+ throw new Error('Missing SSR hydration payload')
+ }
+ const bootstrap = (window as HydrationWindow)._$HY
+ if (!bootstrap || bootstrap.done || sharedConfig.context) {
+ throw new Error('Missing or already consumed Solid hydration bootstrap')
+ }
+ diagnostics = createDiagnostics(countUpdates)
+ router = createFixtureRouter(false, diagnostics)
+ unsubscribe = router.subscribe('onRendered', () => {
+ diagnostics.rendered++
+ })
+ // Solid's RouterClient uses this core restoration API. Await it directly so
+ // the shell has the same component/key hierarchy as the server provider.
+ await hydrate(router)
+ window.$_TSR.h()
+ disposeRoot = hydrateDOM(() => , document)
+}
+
+export function ready() {
+ if (
+ !diagnostics.mounted ||
+ !diagnostics.rendered ||
+ sharedConfig.context ||
+ router?.stores.status.get() === 'pending'
+ ) {
+ return false
+ }
+ // Each Link's onMount updates its hydration signal. Solid updates attributes
+ // through fine-grained effects, without rerendering the route components.
+ for (let index = 0; index < hashLinkCount; index++) {
+ const anchor = document.getElementById(`hash-${index}`)
+ if (
+ !anchor ||
+ anchor.getAttribute('data-status') !== (index % 2 === 0 ? 'active' : null)
+ ) {
+ return false
+ }
+ }
+ return true
+}
+
+export function snapshot() {
+ return {
+ diagnostics: {
+ ...diagnostics,
+ initialHashStates: [...diagnostics.initialHashStates],
+ hashStates: [...diagnostics.hashStates],
+ },
+ hydrating: !!sharedConfig.context,
+ location: router?.stores.location.get().href,
+ resolvedLocation: router?.stores.resolvedLocation.get()?.href,
+ matches: router?.stores.matches.get().map((match) => ({
+ status: match.status,
+ context: match.context,
+ loaderData: match.loaderData,
+ })),
+ }
+}
+
+export function dispose() {
+ try {
+ disposeRoot?.()
+ } finally {
+ unsubscribe?.()
+ router?.history.destroy()
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/src/server.tsx b/benchmarks/client-nav/scenarios/hydration/solid/src/server.tsx
new file mode 100644
index 0000000000..6052c48eac
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/solid/src/server.tsx
@@ -0,0 +1,40 @@
+import { RouterProvider } from '@tanstack/solid-router'
+import {
+ createRequestHandler,
+ renderRouterToStream,
+} from '@tanstack/solid-router/ssr/server'
+import { isServer } from '@tanstack/router-core/isServer'
+import { isServer as solidIsServer } from 'solid-js/web'
+import { createDiagnostics, serverUrl } from '../fixture'
+import { createFixtureRouter } from './app'
+
+export async function renderFixture() {
+ if ((isServer as boolean | undefined) !== true || !solidIsServer) {
+ throw new Error('Fixture generation requires the production server build')
+ }
+ const diagnostics = createDiagnostics()
+ const response = await createRequestHandler({
+ createRouter: () => createFixtureRouter(true, diagnostics),
+ request: new Request(`http://localhost${serverUrl}`),
+ })(({ request, router, responseHeaders }) =>
+ renderRouterToStream({
+ request,
+ router,
+ responseHeaders,
+ // The route shell owns the document, as in Solid Start. Using the same
+ // provider tree on both sides preserves Solid's hydration key sequence.
+ children: () => ,
+ }),
+ )
+ const html = await response.text()
+ if (
+ response.status !== 200 ||
+ diagnostics.beforeLoads !== 3 ||
+ diagnostics.loaders !== 2
+ ) {
+ throw new Error(
+ 'SSR fixture did not execute its beforeLoad and loader functions',
+ )
+ }
+ return html
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/tsconfig.json b/benchmarks/client-nav/scenarios/hydration/solid/tsconfig.json
new file mode 100644
index 0000000000..daf27ddf12
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/solid/tsconfig.json
@@ -0,0 +1,10 @@
+{
+ "extends": "../../../../../tsconfig.json",
+ "compilerOptions": {
+ "jsx": "preserve",
+ "jsxImportSource": "solid-js",
+ "allowImportingTsExtensions": true,
+ "types": ["node", "vite/client", "vitest/globals"]
+ },
+ "include": ["./*.ts", "./src/**/*"]
+}
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/vite.config.ts b/benchmarks/client-nav/scenarios/hydration/solid/vite.config.ts
new file mode 100644
index 0000000000..16e5ff95aa
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/solid/vite.config.ts
@@ -0,0 +1,38 @@
+import { fileURLToPath } from 'node:url'
+import { defineConfig } from 'vitest/config'
+import solid from 'vite-plugin-solid'
+import codspeedPlugin from '@codspeed/vitest-plugin'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
+
+export default defineConfig({
+ root: fileURLToPath(new URL('.', import.meta.url)),
+ define: { 'process.env.NODE_ENV': JSON.stringify('production') },
+ plugins: [
+ !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&
+ codspeedPlugin(),
+ // The Node worker evaluates the prebuilt bundle and needs no JSX transform
+ // or browser test setup injected by vite-plugin-solid.
+ !process.env.VITEST && solid({ ssr: true, hot: false, dev: false }),
+ ],
+ resolve: { conditions: ['solid', 'browser', 'production'] },
+ build: {
+ outDir: './dist/client',
+ emptyOutDir: true,
+ minify: false,
+ lib: {
+ entry: './src/client.tsx',
+ name: 'HydrationBenchmark',
+ formats: ['iife'],
+ fileName: () => 'client.js',
+ },
+ },
+ test: {
+ execArgv: cpuSimulationExecArgv(),
+ name: '@benchmarks/client-nav hydration (solid)',
+ watch: false,
+ environment: 'node',
+ isolate: true,
+ include: ['hydration.test.ts'],
+ benchmark: { include: ['speed.bench.ts'] },
+ },
+})
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/vite.server.config.ts b/benchmarks/client-nav/scenarios/hydration/solid/vite.server.config.ts
new file mode 100644
index 0000000000..9787cbb4e2
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/hydration/solid/vite.server.config.ts
@@ -0,0 +1,29 @@
+import { fileURLToPath } from 'node:url'
+import { defineConfig } from 'vite'
+import solid from 'vite-plugin-solid'
+
+export default defineConfig({
+ root: fileURLToPath(new URL('.', import.meta.url)),
+ define: { 'process.env.NODE_ENV': JSON.stringify('production') },
+ plugins: [solid({ ssr: true, hot: false, dev: false })],
+ resolve: { conditions: ['solid', 'node', 'production'] },
+ ssr: {
+ noExternal: true,
+ resolve: { conditions: ['solid', 'node', 'production'] },
+ },
+ build: {
+ ssr: true,
+ outDir: './dist/server',
+ emptyOutDir: true,
+ minify: false,
+ lib: {
+ entry: './src/server.tsx',
+ formats: ['es'],
+ fileName: () => 'server.js',
+ },
+ rolldownOptions: {
+ platform: 'node',
+ external: [/^node:/],
+ },
+ },
+})
diff --git a/benchmarks/client-nav/scenarios/link-churn/react/project.json b/benchmarks/client-nav/scenarios/link-churn/react/project.json
new file mode 100644
index 0000000000..1606b2c456
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/react/project.json
@@ -0,0 +1,40 @@
+{
+ "name": "@benchmarks/client-nav-link-churn-react",
+ "projectType": "application",
+ "targets": {
+ "build:client": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": [
+ {
+ "projects": ["@tanstack/react-router", "@tanstack/router-plugin"],
+ "target": "build"
+ }
+ ],
+ "options": {
+ "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts"
+ }
+ },
+ "test:types:client": {
+ "executor": "nx:run-commands",
+ "dependsOn": [
+ {
+ "projects": ["@tanstack/react-router", "@tanstack/router-plugin"],
+ "target": "build"
+ }
+ ],
+ "options": {
+ "command": "tsc -p {projectRoot}/tsconfig.json --noEmit"
+ }
+ },
+ "test:flame": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": ["build:client"],
+ "options": {
+ "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/link-churn/react/speed.flame.ts",
+ "cwd": "benchmarks/client-nav"
+ }
+ }
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/react/setup.ts b/benchmarks/client-nav/scenarios/link-churn/react/setup.ts
new file mode 100644
index 0000000000..59221603da
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/react/setup.ts
@@ -0,0 +1,18 @@
+import { createScenarioSetup } from '../../harness'
+import { assertStepResult, initialUrl, scenarioSteps } from '../shared'
+import type * as App from './src/main'
+
+const appModulePath = './dist/app.js'
+const { mountTestApp } = (await import(
+ /* @vite-ignore */ appModulePath
+)) as typeof App
+
+export function setup() {
+ return createScenarioSetup({
+ frameworkLabel: 'React',
+ mount: mountTestApp,
+ steps: scenarioSteps,
+ assertAfterStep: assertStepResult,
+ initialUrl,
+ })
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/react/speed.bench.ts b/benchmarks/client-nav/scenarios/link-churn/react/speed.bench.ts
new file mode 100644
index 0000000000..ca0b370528
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/react/speed.bench.ts
@@ -0,0 +1,19 @@
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
+import { benchOptions, ticksPerIteration } from '../shared'
+import { setup } from './setup'
+
+test('client-link-churn', async ({ bench }) => {
+ const scenario = setup()
+
+ await bench(
+ 'client-link-churn navigation loop (react)',
+ benchLifecycle(scenario),
+ async () => {
+ for (let i = 0; i < ticksPerIteration; i++) {
+ await scenario.tick()
+ }
+ await scenario.finishBatch()
+ },
+ ).run(benchOptions)
+})
diff --git a/benchmarks/client-nav/scenarios/link-churn/react/speed.flame.ts b/benchmarks/client-nav/scenarios/link-churn/react/speed.flame.ts
new file mode 100644
index 0000000000..f4a0b4e6ff
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/react/speed.flame.ts
@@ -0,0 +1,18 @@
+import { window } from '../../../jsdom.ts'
+import { setup } from './setup.ts'
+
+const DURATION_MS = 10_000
+
+const test = setup()
+
+try {
+ await test.before()
+
+ const startedAt = performance.now()
+ while (performance.now() - startedAt < DURATION_MS) {
+ await test.tick()
+ }
+} finally {
+ test.after()
+ window.close()
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/react/src/main.tsx b/benchmarks/client-nav/scenarios/link-churn/react/src/main.tsx
new file mode 100644
index 0000000000..5febd6f795
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/react/src/main.tsx
@@ -0,0 +1,37 @@
+import type { RouterHistory } from '@tanstack/history'
+import { RouterProvider, createRouter } from '@tanstack/react-router'
+import { createRoot } from 'react-dom/client'
+import { routeTree } from './routeTree.gen'
+
+export function createTestRouter(history: RouterHistory) {
+ return createRouter({
+ routeTree,
+ history,
+ scrollRestoration: true,
+ // Key the scroll-restoration cache by pathname instead of the default
+ // random per-entry location key: with push navigations the default mints
+ // a fresh key per navigation and the module-level cache grows one entry
+ // per push for the whole run, which is non-stationary.
+ getScrollRestorationKey: (location) => location.pathname,
+ })
+}
+
+declare module '@tanstack/react-router' {
+ interface Register {
+ router: ReturnType
+ }
+}
+
+export function mountTestApp(container: HTMLElement, history: RouterHistory) {
+ const router = createTestRouter(history)
+
+ const reactRoot = createRoot(container)
+ reactRoot.render( )
+
+ return {
+ router,
+ unmount() {
+ reactRoot.unmount()
+ },
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/react/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/link-churn/react/src/routeTree.gen.ts
new file mode 100644
index 0000000000..4535430b61
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/react/src/routeTree.gen.ts
@@ -0,0 +1,121 @@
+/* eslint-disable */
+
+// @ts-nocheck
+
+// noinspection JSUnusedGlobalSymbols
+
+// This file was automatically generated by TanStack Router.
+// You should NOT make any changes in this file as it will be overwritten.
+// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
+
+import { Route as rootRouteImport } from './routes/__root'
+import { Route as HubRouteImport } from './routes/hub'
+import { Route as OtherRouteImport } from './routes/other'
+import { Route as HubListRouteImport } from './routes/hub.list'
+import { Route as HubDetailIdRouteImport } from './routes/hub.detail.$id'
+
+const HubRoute = HubRouteImport.update({
+ id: '/hub',
+ path: '/hub',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const OtherRoute = OtherRouteImport.update({
+ id: '/other',
+ path: '/other',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const HubListRoute = HubListRouteImport.update({
+ id: '/list',
+ path: '/list',
+ getParentRoute: () => HubRoute,
+} as any)
+const HubDetailIdRoute = HubDetailIdRouteImport.update({
+ id: '/detail/$id',
+ path: '/detail/$id',
+ getParentRoute: () => HubRoute,
+} as any)
+
+export interface FileRoutesByFullPath {
+ '/hub': typeof HubRouteWithChildren
+ '/other': typeof OtherRoute
+ '/hub/list': typeof HubListRoute
+ '/hub/detail/$id': typeof HubDetailIdRoute
+}
+export interface FileRoutesByTo {
+ '/hub': typeof HubRouteWithChildren
+ '/other': typeof OtherRoute
+ '/hub/list': typeof HubListRoute
+ '/hub/detail/$id': typeof HubDetailIdRoute
+}
+export interface FileRoutesById {
+ __root__: typeof rootRouteImport
+ '/hub': typeof HubRouteWithChildren
+ '/other': typeof OtherRoute
+ '/hub/list': typeof HubListRoute
+ '/hub/detail/$id': typeof HubDetailIdRoute
+}
+export interface FileRouteTypes {
+ fileRoutesByFullPath: FileRoutesByFullPath
+ fullPaths: '/hub' | '/other' | '/hub/list' | '/hub/detail/$id'
+ fileRoutesByTo: FileRoutesByTo
+ to: '/hub' | '/other' | '/hub/list' | '/hub/detail/$id'
+ id: '__root__' | '/hub' | '/other' | '/hub/list' | '/hub/detail/$id'
+ fileRoutesById: FileRoutesById
+}
+export interface RootRouteChildren {
+ HubRoute: typeof HubRouteWithChildren
+ OtherRoute: typeof OtherRoute
+}
+
+declare module '@tanstack/react-router' {
+ interface FileRoutesByPath {
+ '/hub': {
+ id: '/hub'
+ path: '/hub'
+ fullPath: '/hub'
+ preLoaderRoute: typeof HubRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/other': {
+ id: '/other'
+ path: '/other'
+ fullPath: '/other'
+ preLoaderRoute: typeof OtherRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/hub/list': {
+ id: '/hub/list'
+ path: '/list'
+ fullPath: '/hub/list'
+ preLoaderRoute: typeof HubListRouteImport
+ parentRoute: typeof HubRoute
+ }
+ '/hub/detail/$id': {
+ id: '/hub/detail/$id'
+ path: '/detail/$id'
+ fullPath: '/hub/detail/$id'
+ preLoaderRoute: typeof HubDetailIdRouteImport
+ parentRoute: typeof HubRoute
+ }
+ }
+}
+
+interface HubRouteChildren {
+ HubListRoute: typeof HubListRoute
+ HubDetailIdRoute: typeof HubDetailIdRoute
+}
+
+const HubRouteChildren: HubRouteChildren = {
+ HubListRoute: HubListRoute,
+ HubDetailIdRoute: HubDetailIdRoute,
+}
+
+const HubRouteWithChildren = HubRoute._addFileChildren(HubRouteChildren)
+
+const rootRouteChildren: RootRouteChildren = {
+ HubRoute: HubRouteWithChildren,
+ OtherRoute: OtherRoute,
+}
+export const routeTree = rootRouteImport
+ ._addFileChildren(rootRouteChildren)
+ ._addFileTypes()
diff --git a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/__root.tsx
new file mode 100644
index 0000000000..199cf1ff73
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/__root.tsx
@@ -0,0 +1,39 @@
+import { Link, Outlet, createRootRoute } from '@tanstack/react-router'
+import { sortedSearch } from '../../../shared'
+
+export const Route = createRootRoute({
+ component: RootComponent,
+})
+
+function RootComponent() {
+ return (
+ <>
+
+
+ List
+
+
+ List sorted
+
+
+ Detail 1
+
+
+ Detail 2
+
+
+ Other
+
+
+
+ >
+ )
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.detail.$id.tsx b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.detail.$id.tsx
new file mode 100644
index 0000000000..143cb39a7a
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.detail.$id.tsx
@@ -0,0 +1,21 @@
+import { Link, createFileRoute } from '@tanstack/react-router'
+import { detailMarker } from '../../../shared'
+
+export const Route = createFileRoute('/hub/detail/$id')({
+ component: DetailPage,
+})
+
+function DetailPage() {
+ const params = Route.useParams()
+
+ return (
+
+ {detailMarker(params.id)}
+ Back to list
+
+ Next
+
+ Elsewhere
+
+ )
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.list.tsx b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.list.tsx
new file mode 100644
index 0000000000..5aa37b20a7
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.list.tsx
@@ -0,0 +1,65 @@
+import { Link, createFileRoute } from '@tanstack/react-router'
+import {
+ listItemIds,
+ listMarker,
+ listRelativeTestId,
+ listSortedMarker,
+} from '../../../shared'
+
+export const Route = createFileRoute('/hub/list')({
+ component: ListPage,
+})
+
+const ascSearch = { sort: 'asc' } as const
+
+// List Links depart whenever the list leaf is left.
+function ListLinks() {
+ return (
+
+ {listItemIds.map((id) => {
+ const page = Number(id)
+ return (
+
+
+ {`Item ${id}`}
+
+
+ {`Item ${id} asc`}
+
+
+ {`Item ${id} exact`}
+
+ ({ ...prev, page })}>
+ {`Page ${id}`}
+
+ ({ ...prev, page, sort: 'asc' as const })}
+ data-testid={id === '1' ? listRelativeTestId : undefined}
+ >
+ {`Page ${id} asc`}
+
+
+ )
+ })}
+
+ )
+}
+
+function ListPage() {
+ const sort = Route.useSearch({ select: (search) => search.sort })
+
+ return (
+
+
+ {sort === 'desc' ? listSortedMarker : listMarker}
+
+
+
+ )
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.tsx b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.tsx
new file mode 100644
index 0000000000..ac12eae2da
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.tsx
@@ -0,0 +1,64 @@
+import { Link, Outlet, createFileRoute } from '@tanstack/react-router'
+import {
+ hubItemIds,
+ hubRelativeTestId,
+ validateHubSearch,
+} from '../../../shared'
+
+export const Route = createFileRoute('/hub')({
+ validateSearch: validateHubSearch,
+ component: HubLayout,
+})
+
+// Layout Links stay mounted while the hub leaves change.
+function HubLinks() {
+ return (
+
+ {hubItemIds.map((id) => {
+ const page = Number(id)
+ return (
+
+
+ {`Detail ${id}`}
+
+
+ {`Detail ${id} exact`}
+
+
+ {`List page ${id}`}
+
+ ({ ...prev, page })}>
+ {`List keep ${id}`}
+
+ ({ ...prev, page })}
+ data-testid={id === '1' ? hubRelativeTestId : undefined}
+ >
+ {`Here page ${id}`}
+
+
+ )
+ })}
+
+ )
+}
+
+function HubLayout() {
+ return (
+
+ )
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/other.tsx b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/other.tsx
new file mode 100644
index 0000000000..1f146b789f
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/other.tsx
@@ -0,0 +1,14 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { otherMarker } from '../../../shared'
+
+export const Route = createFileRoute('/other')({
+ component: OtherPage,
+})
+
+function OtherPage() {
+ return (
+
+ {otherMarker}
+
+ )
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/react/tsconfig.json b/benchmarks/client-nav/scenarios/link-churn/react/tsconfig.json
new file mode 100644
index 0000000000..1d59cbb450
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/react/tsconfig.json
@@ -0,0 +1,21 @@
+{
+ "extends": "../../../../../tsconfig.json",
+ "compilerOptions": {
+ "jsx": "react-jsx",
+ "jsxImportSource": "react",
+ "allowImportingTsExtensions": true,
+ "types": ["node", "vite/client", "vitest/globals"]
+ },
+ "include": [
+ "speed.bench.ts",
+ "speed.flame.ts",
+ "setup.ts",
+ "vite.config.ts",
+ "../shared.ts",
+ "../../harness.ts",
+ "../../../setup-helpers.ts",
+ "../../../jsdom.ts",
+ "../../../vitest.setup.ts",
+ "./src/**/*"
+ ]
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/react/vite.config.ts b/benchmarks/client-nav/scenarios/link-churn/react/vite.config.ts
new file mode 100644
index 0000000000..344974ebf9
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/react/vite.config.ts
@@ -0,0 +1,42 @@
+import { fileURLToPath } from 'node:url'
+import { defineConfig } from 'vitest/config'
+import react from '@vitejs/plugin-react'
+import codspeedPlugin from '@codspeed/vitest-plugin'
+import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
+
+const rootDir = fileURLToPath(new URL('.', import.meta.url))
+
+export default defineConfig({
+ root: rootDir,
+ define: {
+ 'process.env.NODE_ENV': JSON.stringify('production'),
+ },
+ plugins: [
+ !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&
+ codspeedPlugin(),
+ tanstackRouter({
+ target: 'react',
+ routesDirectory: `${rootDir}src/routes`,
+ generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
+ }),
+ react(),
+ ],
+ build: {
+ outDir: './dist',
+ emptyOutDir: true,
+ minify: false,
+ lib: {
+ entry: './src/main.tsx',
+ formats: ['es'],
+ fileName: 'app',
+ },
+ },
+ test: {
+ execArgv: cpuSimulationExecArgv(),
+ name: '@benchmarks/client-nav link-churn (react)',
+ watch: false,
+ environment: 'jsdom',
+ setupFiles: ['../../../vitest.setup.ts'],
+ },
+})
diff --git a/benchmarks/client-nav/scenarios/link-churn/shared.ts b/benchmarks/client-nav/scenarios/link-churn/shared.ts
new file mode 100644
index 0000000000..d936af35cc
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/shared.ts
@@ -0,0 +1,178 @@
+/**
+ * Shared definition of the `link-churn` scenario: Links that leave, stay and
+ * arrive across navigations. A `/hub` layout renders Links that stay mounted
+ * while its leaves change; the `/hub/list` leaf renders Links that depart when
+ * leaving it and mount again when returning; `/other` sits outside the layout
+ * so leaving the list there unmounts layout and leaf Links together. The
+ * existing `links` scenario keeps all its Links in the root layout, so none of
+ * them ever departs or remounts. The three framework apps consume these
+ * constants so the workload is identical modulo the rendering layer.
+ */
+import type { ScenarioStep } from '../harness'
+
+// Layout (staying) Links: HUB_ITEM_COUNT ids x 5 variants.
+export const HUB_ITEM_COUNT = 6
+// List leaf (departing) Links: LIST_ITEM_COUNT ids x 5 variants.
+export const LIST_ITEM_COUNT = 20
+
+const ids = (count: number) =>
+ Array.from({ length: count }, (_, index) => String(index + 1))
+
+export const hubItemIds = ids(HUB_ITEM_COUNT)
+export const listItemIds = ids(LIST_ITEM_COUNT)
+
+export interface HubSearch {
+ page?: number
+ sort?: 'asc' | 'desc'
+}
+
+/** Search validation of the `/hub` layout, inherited by its leaves. */
+export function validateHubSearch(search: Record): HubSearch {
+ const result: HubSearch = {}
+ if (typeof search.page === 'number') {
+ result.page = search.page
+ }
+ if (search.sort === 'asc' || search.sort === 'desc') {
+ result.sort = search.sort
+ }
+ return result
+}
+
+export const sortedSearch = { sort: 'desc' } as const
+
+export function detailMarker(id: string) {
+ return `detail-${id}`
+}
+
+export const listMarker = 'list'
+export const listSortedMarker = 'list-desc'
+export const otherMarker = 'other'
+
+// Sampled Links whose href depends on the current location: the first layout
+// `to="."` updater Link and the first list `to="."` updater Link.
+export const hubRelativeTestId = 'hub-relative-1'
+export const listRelativeTestId = 'list-relative-1'
+
+interface StepDef {
+ testId: string
+ marker: string
+ /** Expected number of `.active-link` elements after the step. */
+ activeCount: number
+ /** Expected href of the sampled layout updater Link (null: not mounted). */
+ hubRelativeHref: string | null
+ /** Expected href of the sampled list updater Link (null: not mounted). */
+ listRelativeHref: string | null
+}
+
+// On the list, every layout `includeSearch: false` Link to the list is active.
+const listActiveCount = HUB_ITEM_COUNT
+
+export const stepDefs: ReadonlyArray = [
+ // 1. list -> detail/1: list Links depart, layout Links stay and update.
+ {
+ testId: 'go-detail-1',
+ marker: detailMarker('1'),
+ activeCount: 1,
+ hubRelativeHref: '/hub/detail/1?page=1',
+ listRelativeHref: null,
+ },
+ // 2. detail/1 -> detail/2: same route, new param; every Link stays.
+ {
+ testId: 'go-detail-2',
+ marker: detailMarker('2'),
+ activeCount: 1,
+ hubRelativeHref: '/hub/detail/2?page=1',
+ listRelativeHref: null,
+ },
+ // 3. detail/2 -> list: list Links mount.
+ {
+ testId: 'go-list',
+ marker: listMarker,
+ activeCount: listActiveCount,
+ hubRelativeHref: '/hub/list?page=1',
+ listRelativeHref: '/hub/list?page=1&sort=asc',
+ },
+ // 4. list -> other: layout and list Links depart together.
+ {
+ testId: 'go-other',
+ marker: otherMarker,
+ activeCount: 0,
+ hubRelativeHref: null,
+ listRelativeHref: null,
+ },
+ // 5. other -> list: layout and list Links all mount.
+ {
+ testId: 'go-list',
+ marker: listMarker,
+ activeCount: listActiveCount,
+ hubRelativeHref: '/hub/list?page=1',
+ listRelativeHref: '/hub/list?page=1&sort=asc',
+ },
+ // 6a. list -> list?sort=desc: nothing departs, updater Links rebuild.
+ {
+ testId: 'go-list-sorted',
+ marker: listSortedMarker,
+ activeCount: listActiveCount,
+ hubRelativeHref: '/hub/list?sort=desc&page=1',
+ listRelativeHref: '/hub/list?sort=asc&page=1',
+ },
+ // 6b. back to the plain list so the lap ends on the initial location.
+ {
+ testId: 'go-list',
+ marker: listMarker,
+ activeCount: listActiveCount,
+ hubRelativeHref: '/hub/list?page=1',
+ listRelativeHref: '/hub/list?page=1&sort=asc',
+ },
+]
+
+export const initialUrl = '/hub/list'
+
+export const scenarioSteps: ReadonlyArray = stepDefs.map(
+ (step) => step.testId,
+)
+
+function assertHref(
+ container: HTMLElement,
+ testId: string,
+ expected: string | null,
+ stepIndex: number,
+) {
+ const link = container.querySelector(`[data-testid="${testId}"]`)
+ const href = link ? link.getAttribute('href') : null
+ if (href !== expected) {
+ throw new Error(
+ `Expected "${testId}" href ${JSON.stringify(expected)} after step ${stepIndex}, received ${JSON.stringify(href)}`,
+ )
+ }
+}
+
+export function assertStepResult(stepIndex: number, container: HTMLElement) {
+ const step = stepDefs[stepIndex]!
+
+ const marker = container.querySelector('[data-testid="page-state"]')
+ if (marker?.textContent !== step.marker) {
+ throw new Error(
+ `Expected page marker "${step.marker}" after step ${stepIndex}, received "${marker?.textContent}"`,
+ )
+ }
+
+ const activeLinks = container.querySelectorAll('a.active-link')
+ if (activeLinks.length !== step.activeCount) {
+ throw new Error(
+ `Expected ${step.activeCount} active link(s) after step ${stepIndex}, received ${activeLinks.length}`,
+ )
+ }
+
+ assertHref(container, hubRelativeTestId, step.hubRelativeHref, stepIndex)
+ assertHref(container, listRelativeTestId, step.listRelativeHref, stepIndex)
+}
+
+// One lap through the 7-step sequence per benchmark iteration.
+export const ticksPerIteration = stepDefs.length
+
+export const benchOptions = {
+ warmupIterations: 50,
+ time: 10_000,
+ throws: true,
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/project.json b/benchmarks/client-nav/scenarios/link-churn/solid/project.json
new file mode 100644
index 0000000000..4e46143b32
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/solid/project.json
@@ -0,0 +1,40 @@
+{
+ "name": "@benchmarks/client-nav-link-churn-solid",
+ "projectType": "application",
+ "targets": {
+ "build:client": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": [
+ {
+ "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"],
+ "target": "build"
+ }
+ ],
+ "options": {
+ "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts"
+ }
+ },
+ "test:types:client": {
+ "executor": "nx:run-commands",
+ "dependsOn": [
+ {
+ "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"],
+ "target": "build"
+ }
+ ],
+ "options": {
+ "command": "tsc -p {projectRoot}/tsconfig.json --noEmit"
+ }
+ },
+ "test:flame": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": ["build:client"],
+ "options": {
+ "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/link-churn/solid/speed.flame.ts",
+ "cwd": "benchmarks/client-nav"
+ }
+ }
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/setup.ts b/benchmarks/client-nav/scenarios/link-churn/solid/setup.ts
new file mode 100644
index 0000000000..a2a024341d
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/solid/setup.ts
@@ -0,0 +1,18 @@
+import { createScenarioSetup } from '../../harness'
+import { assertStepResult, initialUrl, scenarioSteps } from '../shared'
+import type * as App from './src/main'
+
+const appModulePath = './dist/app.js'
+const { mountTestApp } = (await import(
+ /* @vite-ignore */ appModulePath
+)) as typeof App
+
+export function setup() {
+ return createScenarioSetup({
+ frameworkLabel: 'Solid',
+ mount: mountTestApp,
+ steps: scenarioSteps,
+ assertAfterStep: assertStepResult,
+ initialUrl,
+ })
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/link-churn/solid/speed.bench.ts
new file mode 100644
index 0000000000..80c4aaa6fd
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/solid/speed.bench.ts
@@ -0,0 +1,19 @@
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
+import { benchOptions, ticksPerIteration } from '../shared'
+import { setup } from './setup'
+
+test('client-link-churn', async ({ bench }) => {
+ const scenario = setup()
+
+ await bench(
+ 'client-link-churn navigation loop (solid)',
+ benchLifecycle(scenario),
+ async () => {
+ for (let i = 0; i < ticksPerIteration; i++) {
+ await scenario.tick()
+ }
+ await scenario.finishBatch()
+ },
+ ).run(benchOptions)
+})
diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/speed.flame.ts b/benchmarks/client-nav/scenarios/link-churn/solid/speed.flame.ts
new file mode 100644
index 0000000000..f4a0b4e6ff
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/solid/speed.flame.ts
@@ -0,0 +1,18 @@
+import { window } from '../../../jsdom.ts'
+import { setup } from './setup.ts'
+
+const DURATION_MS = 10_000
+
+const test = setup()
+
+try {
+ await test.before()
+
+ const startedAt = performance.now()
+ while (performance.now() - startedAt < DURATION_MS) {
+ await test.tick()
+ }
+} finally {
+ test.after()
+ window.close()
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/src/main.tsx b/benchmarks/client-nav/scenarios/link-churn/solid/src/main.tsx
new file mode 100644
index 0000000000..fa9d239418
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/solid/src/main.tsx
@@ -0,0 +1,34 @@
+import type { RouterHistory } from '@tanstack/history'
+import { render } from 'solid-js/web'
+import { RouterProvider, createRouter } from '@tanstack/solid-router'
+import { routeTree } from './routeTree.gen'
+
+export function createTestRouter(history: RouterHistory) {
+ return createRouter({
+ routeTree,
+ history,
+ scrollRestoration: true,
+ // Key the scroll-restoration cache by pathname instead of the default
+ // random per-entry location key: with push navigations the default mints
+ // a fresh key per navigation and the module-level cache grows one entry
+ // per push for the whole run, which is non-stationary.
+ getScrollRestorationKey: (location) => location.pathname,
+ })
+}
+
+declare module '@tanstack/solid-router' {
+ interface Register {
+ router: ReturnType
+ }
+}
+
+export function mountTestApp(container: HTMLElement, history: RouterHistory) {
+ const router = createTestRouter(history)
+
+ const unmount = render(() => , container)
+
+ return {
+ router,
+ unmount,
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/link-churn/solid/src/routeTree.gen.ts
new file mode 100644
index 0000000000..e3cb546963
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/solid/src/routeTree.gen.ts
@@ -0,0 +1,121 @@
+/* eslint-disable */
+
+// @ts-nocheck
+
+// noinspection JSUnusedGlobalSymbols
+
+// This file was automatically generated by TanStack Router.
+// You should NOT make any changes in this file as it will be overwritten.
+// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
+
+import { Route as rootRouteImport } from './routes/__root'
+import { Route as HubRouteImport } from './routes/hub'
+import { Route as OtherRouteImport } from './routes/other'
+import { Route as HubListRouteImport } from './routes/hub.list'
+import { Route as HubDetailIdRouteImport } from './routes/hub.detail.$id'
+
+const HubRoute = HubRouteImport.update({
+ id: '/hub',
+ path: '/hub',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const OtherRoute = OtherRouteImport.update({
+ id: '/other',
+ path: '/other',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const HubListRoute = HubListRouteImport.update({
+ id: '/list',
+ path: '/list',
+ getParentRoute: () => HubRoute,
+} as any)
+const HubDetailIdRoute = HubDetailIdRouteImport.update({
+ id: '/detail/$id',
+ path: '/detail/$id',
+ getParentRoute: () => HubRoute,
+} as any)
+
+export interface FileRoutesByFullPath {
+ '/hub': typeof HubRouteWithChildren
+ '/other': typeof OtherRoute
+ '/hub/list': typeof HubListRoute
+ '/hub/detail/$id': typeof HubDetailIdRoute
+}
+export interface FileRoutesByTo {
+ '/hub': typeof HubRouteWithChildren
+ '/other': typeof OtherRoute
+ '/hub/list': typeof HubListRoute
+ '/hub/detail/$id': typeof HubDetailIdRoute
+}
+export interface FileRoutesById {
+ __root__: typeof rootRouteImport
+ '/hub': typeof HubRouteWithChildren
+ '/other': typeof OtherRoute
+ '/hub/list': typeof HubListRoute
+ '/hub/detail/$id': typeof HubDetailIdRoute
+}
+export interface FileRouteTypes {
+ fileRoutesByFullPath: FileRoutesByFullPath
+ fullPaths: '/hub' | '/other' | '/hub/list' | '/hub/detail/$id'
+ fileRoutesByTo: FileRoutesByTo
+ to: '/hub' | '/other' | '/hub/list' | '/hub/detail/$id'
+ id: '__root__' | '/hub' | '/other' | '/hub/list' | '/hub/detail/$id'
+ fileRoutesById: FileRoutesById
+}
+export interface RootRouteChildren {
+ HubRoute: typeof HubRouteWithChildren
+ OtherRoute: typeof OtherRoute
+}
+
+declare module '@tanstack/solid-router' {
+ interface FileRoutesByPath {
+ '/hub': {
+ id: '/hub'
+ path: '/hub'
+ fullPath: '/hub'
+ preLoaderRoute: typeof HubRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/other': {
+ id: '/other'
+ path: '/other'
+ fullPath: '/other'
+ preLoaderRoute: typeof OtherRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/hub/list': {
+ id: '/hub/list'
+ path: '/list'
+ fullPath: '/hub/list'
+ preLoaderRoute: typeof HubListRouteImport
+ parentRoute: typeof HubRoute
+ }
+ '/hub/detail/$id': {
+ id: '/hub/detail/$id'
+ path: '/detail/$id'
+ fullPath: '/hub/detail/$id'
+ preLoaderRoute: typeof HubDetailIdRouteImport
+ parentRoute: typeof HubRoute
+ }
+ }
+}
+
+interface HubRouteChildren {
+ HubListRoute: typeof HubListRoute
+ HubDetailIdRoute: typeof HubDetailIdRoute
+}
+
+const HubRouteChildren: HubRouteChildren = {
+ HubListRoute: HubListRoute,
+ HubDetailIdRoute: HubDetailIdRoute,
+}
+
+const HubRouteWithChildren = HubRoute._addFileChildren(HubRouteChildren)
+
+const rootRouteChildren: RootRouteChildren = {
+ HubRoute: HubRouteWithChildren,
+ OtherRoute: OtherRoute,
+}
+export const routeTree = rootRouteImport
+ ._addFileChildren(rootRouteChildren)
+ ._addFileTypes()
diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/__root.tsx
new file mode 100644
index 0000000000..a9de4ea356
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/__root.tsx
@@ -0,0 +1,39 @@
+import { Link, Outlet, createRootRoute } from '@tanstack/solid-router'
+import { sortedSearch } from '../../../shared'
+
+export const Route = createRootRoute({
+ component: RootComponent,
+})
+
+function RootComponent() {
+ return (
+ <>
+
+
+ List
+
+
+ List sorted
+
+
+ Detail 1
+
+
+ Detail 2
+
+
+ Other
+
+
+
+ >
+ )
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.detail.$id.tsx b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.detail.$id.tsx
new file mode 100644
index 0000000000..7aca4a9935
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.detail.$id.tsx
@@ -0,0 +1,24 @@
+import { Link, createFileRoute } from '@tanstack/solid-router'
+import { detailMarker } from '../../../shared'
+
+export const Route = createFileRoute('/hub/detail/$id')({
+ component: DetailPage,
+})
+
+function DetailPage() {
+ const params = Route.useParams()
+
+ return (
+
+ {detailMarker(params().id)}
+ Back to list
+
+ Next
+
+ Elsewhere
+
+ )
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.list.tsx b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.list.tsx
new file mode 100644
index 0000000000..5796a50b02
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.list.tsx
@@ -0,0 +1,68 @@
+import { For } from 'solid-js'
+import { Link, createFileRoute } from '@tanstack/solid-router'
+import {
+ listItemIds,
+ listMarker,
+ listRelativeTestId,
+ listSortedMarker,
+} from '../../../shared'
+
+export const Route = createFileRoute('/hub/list')({
+ component: ListPage,
+})
+
+const ascSearch = { sort: 'asc' } as const
+
+// List Links depart whenever the list leaf is left.
+function ListLinks() {
+ return (
+
+
+ {(id) => {
+ const page = Number(id)
+ return (
+
+
+ {`Item ${id}`}
+
+
+ {`Item ${id} asc`}
+
+
+ {`Item ${id} exact`}
+
+ ({ ...prev, page })}>
+ {`Page ${id}`}
+
+ ({ ...prev, page, sort: 'asc' as const })}
+ data-testid={id === '1' ? listRelativeTestId : undefined}
+ >
+ {`Page ${id} asc`}
+
+
+ )
+ }}
+
+
+ )
+}
+
+function ListPage() {
+ const sort = Route.useSearch({ select: (search) => search.sort })
+
+ return (
+
+
+ {sort() === 'desc' ? listSortedMarker : listMarker}
+
+
+
+ )
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.tsx b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.tsx
new file mode 100644
index 0000000000..4682f85aae
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.tsx
@@ -0,0 +1,67 @@
+import { For } from 'solid-js'
+import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'
+import {
+ hubItemIds,
+ hubRelativeTestId,
+ validateHubSearch,
+} from '../../../shared'
+
+export const Route = createFileRoute('/hub')({
+ validateSearch: validateHubSearch,
+ component: HubLayout,
+})
+
+// Layout Links stay mounted while the hub leaves change.
+function HubLinks() {
+ return (
+
+
+ {(id) => {
+ const page = Number(id)
+ return (
+
+
+ {`Detail ${id}`}
+
+
+ {`Detail ${id} exact`}
+
+
+ {`List page ${id}`}
+
+ ({ ...prev, page })}>
+ {`List keep ${id}`}
+
+ ({ ...prev, page })}
+ data-testid={id === '1' ? hubRelativeTestId : undefined}
+ >
+ {`Here page ${id}`}
+
+
+ )
+ }}
+
+
+ )
+}
+
+function HubLayout() {
+ return (
+
+ )
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/other.tsx b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/other.tsx
new file mode 100644
index 0000000000..2606089113
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/other.tsx
@@ -0,0 +1,14 @@
+import { createFileRoute } from '@tanstack/solid-router'
+import { otherMarker } from '../../../shared'
+
+export const Route = createFileRoute('/other')({
+ component: OtherPage,
+})
+
+function OtherPage() {
+ return (
+
+ {otherMarker}
+
+ )
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/tsconfig.json b/benchmarks/client-nav/scenarios/link-churn/solid/tsconfig.json
new file mode 100644
index 0000000000..98d76ad6b8
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/solid/tsconfig.json
@@ -0,0 +1,21 @@
+{
+ "extends": "../../../../../tsconfig.json",
+ "compilerOptions": {
+ "jsx": "preserve",
+ "jsxImportSource": "solid-js",
+ "allowImportingTsExtensions": true,
+ "types": ["node", "vite/client", "vitest/globals"]
+ },
+ "include": [
+ "speed.bench.ts",
+ "speed.flame.ts",
+ "setup.ts",
+ "vite.config.ts",
+ "../shared.ts",
+ "../../harness.ts",
+ "../../../setup-helpers.ts",
+ "../../../jsdom.ts",
+ "../../../vitest.setup.ts",
+ "./src/**/*"
+ ]
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/vite.config.ts b/benchmarks/client-nav/scenarios/link-churn/solid/vite.config.ts
new file mode 100644
index 0000000000..37718a2d6a
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/solid/vite.config.ts
@@ -0,0 +1,50 @@
+import { fileURLToPath } from 'node:url'
+import { defineConfig } from 'vitest/config'
+import solid from 'vite-plugin-solid'
+import codspeedPlugin from '@codspeed/vitest-plugin'
+import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
+
+const rootDir = fileURLToPath(new URL('.', import.meta.url))
+
+export default defineConfig({
+ root: rootDir,
+ define: {
+ 'process.env.NODE_ENV': JSON.stringify('production'),
+ },
+ plugins: [
+ !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&
+ codspeedPlugin(),
+ tanstackRouter({
+ target: 'solid',
+ routesDirectory: `${rootDir}src/routes`,
+ generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
+ }),
+ solid({ hot: false, dev: false }),
+ ],
+ build: {
+ outDir: './dist',
+ emptyOutDir: true,
+ minify: false,
+ lib: {
+ entry: './src/main.tsx',
+ formats: ['es'],
+ fileName: 'app',
+ },
+ },
+ resolve: {
+ conditions: ['solid', 'browser'],
+ },
+ test: {
+ execArgv: cpuSimulationExecArgv(),
+ name: '@benchmarks/client-nav link-churn (solid)',
+ watch: false,
+ environment: 'jsdom',
+ setupFiles: ['../../../vitest.setup.ts'],
+ server: {
+ deps: {
+ inline: [/@solidjs/, /@tanstack\/solid-store/],
+ },
+ },
+ },
+})
diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/project.json b/benchmarks/client-nav/scenarios/link-churn/vue/project.json
new file mode 100644
index 0000000000..fb890ddfb8
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/vue/project.json
@@ -0,0 +1,40 @@
+{
+ "name": "@benchmarks/client-nav-link-churn-vue",
+ "projectType": "application",
+ "targets": {
+ "build:client": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": [
+ {
+ "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"],
+ "target": "build"
+ }
+ ],
+ "options": {
+ "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts"
+ }
+ },
+ "test:types:client": {
+ "executor": "nx:run-commands",
+ "dependsOn": [
+ {
+ "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"],
+ "target": "build"
+ }
+ ],
+ "options": {
+ "command": "tsc -p {projectRoot}/tsconfig.json --noEmit"
+ }
+ },
+ "test:flame": {
+ "executor": "nx:run-commands",
+ "cache": false,
+ "dependsOn": ["build:client"],
+ "options": {
+ "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/link-churn/vue/speed.flame.ts",
+ "cwd": "benchmarks/client-nav"
+ }
+ }
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/setup.ts b/benchmarks/client-nav/scenarios/link-churn/vue/setup.ts
new file mode 100644
index 0000000000..95cacb9ea8
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/vue/setup.ts
@@ -0,0 +1,18 @@
+import { createScenarioSetup } from '../../harness'
+import { assertStepResult, initialUrl, scenarioSteps } from '../shared'
+import type * as App from './src/main'
+
+const appModulePath = './dist/app.js'
+const { mountTestApp } = (await import(
+ /* @vite-ignore */ appModulePath
+)) as typeof App
+
+export function setup() {
+ return createScenarioSetup({
+ frameworkLabel: 'Vue',
+ mount: mountTestApp,
+ steps: scenarioSteps,
+ assertAfterStep: assertStepResult,
+ initialUrl,
+ })
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/link-churn/vue/speed.bench.ts
new file mode 100644
index 0000000000..dea511c24c
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/vue/speed.bench.ts
@@ -0,0 +1,19 @@
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
+import { benchOptions, ticksPerIteration } from '../shared'
+import { setup } from './setup'
+
+test('client-link-churn', async ({ bench }) => {
+ const scenario = setup()
+
+ await bench(
+ 'client-link-churn navigation loop (vue)',
+ benchLifecycle(scenario),
+ async () => {
+ for (let i = 0; i < ticksPerIteration; i++) {
+ await scenario.tick()
+ }
+ await scenario.finishBatch()
+ },
+ ).run(benchOptions)
+})
diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/speed.flame.ts b/benchmarks/client-nav/scenarios/link-churn/vue/speed.flame.ts
new file mode 100644
index 0000000000..f4a0b4e6ff
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/vue/speed.flame.ts
@@ -0,0 +1,18 @@
+import { window } from '../../../jsdom.ts'
+import { setup } from './setup.ts'
+
+const DURATION_MS = 10_000
+
+const test = setup()
+
+try {
+ await test.before()
+
+ const startedAt = performance.now()
+ while (performance.now() - startedAt < DURATION_MS) {
+ await test.tick()
+ }
+} finally {
+ test.after()
+ window.close()
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/src/main.tsx b/benchmarks/client-nav/scenarios/link-churn/vue/src/main.tsx
new file mode 100644
index 0000000000..cae9b54f1d
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/vue/src/main.tsx
@@ -0,0 +1,41 @@
+import type { RouterHistory } from '@tanstack/history'
+import * as Vue from 'vue'
+import { RouterProvider, createRouter } from '@tanstack/vue-router'
+import { routeTree } from './routeTree.gen'
+
+export function createTestRouter(history: RouterHistory) {
+ return createRouter({
+ routeTree,
+ history,
+ scrollRestoration: true,
+ // Key the scroll-restoration cache by pathname instead of the default
+ // random per-entry location key: with push navigations the default mints
+ // a fresh key per navigation and the module-level cache grows one entry
+ // per push for the whole run, which is non-stationary.
+ getScrollRestorationKey: (location) => location.pathname,
+ })
+}
+
+declare module '@tanstack/vue-router' {
+ interface Register {
+ router: ReturnType
+ }
+}
+
+export function mountTestApp(container: HTMLElement, history: RouterHistory) {
+ const router = createTestRouter(history)
+
+ const component =
+ const app = Vue.createApp({
+ render: () => component,
+ })
+
+ app.mount(container)
+
+ return {
+ router,
+ unmount() {
+ app.unmount()
+ },
+ }
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/link-churn/vue/src/routeTree.gen.ts
new file mode 100644
index 0000000000..9327bbc01d
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/vue/src/routeTree.gen.ts
@@ -0,0 +1,121 @@
+/* eslint-disable */
+
+// @ts-nocheck
+
+// noinspection JSUnusedGlobalSymbols
+
+// This file was automatically generated by TanStack Router.
+// You should NOT make any changes in this file as it will be overwritten.
+// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
+
+import { Route as rootRouteImport } from './routes/__root'
+import { Route as HubRouteImport } from './routes/hub'
+import { Route as OtherRouteImport } from './routes/other'
+import { Route as HubListRouteImport } from './routes/hub.list'
+import { Route as HubDetailIdRouteImport } from './routes/hub.detail.$id'
+
+const HubRoute = HubRouteImport.update({
+ id: '/hub',
+ path: '/hub',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const OtherRoute = OtherRouteImport.update({
+ id: '/other',
+ path: '/other',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const HubListRoute = HubListRouteImport.update({
+ id: '/list',
+ path: '/list',
+ getParentRoute: () => HubRoute,
+} as any)
+const HubDetailIdRoute = HubDetailIdRouteImport.update({
+ id: '/detail/$id',
+ path: '/detail/$id',
+ getParentRoute: () => HubRoute,
+} as any)
+
+export interface FileRoutesByFullPath {
+ '/hub': typeof HubRouteWithChildren
+ '/other': typeof OtherRoute
+ '/hub/list': typeof HubListRoute
+ '/hub/detail/$id': typeof HubDetailIdRoute
+}
+export interface FileRoutesByTo {
+ '/hub': typeof HubRouteWithChildren
+ '/other': typeof OtherRoute
+ '/hub/list': typeof HubListRoute
+ '/hub/detail/$id': typeof HubDetailIdRoute
+}
+export interface FileRoutesById {
+ __root__: typeof rootRouteImport
+ '/hub': typeof HubRouteWithChildren
+ '/other': typeof OtherRoute
+ '/hub/list': typeof HubListRoute
+ '/hub/detail/$id': typeof HubDetailIdRoute
+}
+export interface FileRouteTypes {
+ fileRoutesByFullPath: FileRoutesByFullPath
+ fullPaths: '/hub' | '/other' | '/hub/list' | '/hub/detail/$id'
+ fileRoutesByTo: FileRoutesByTo
+ to: '/hub' | '/other' | '/hub/list' | '/hub/detail/$id'
+ id: '__root__' | '/hub' | '/other' | '/hub/list' | '/hub/detail/$id'
+ fileRoutesById: FileRoutesById
+}
+export interface RootRouteChildren {
+ HubRoute: typeof HubRouteWithChildren
+ OtherRoute: typeof OtherRoute
+}
+
+declare module '@tanstack/vue-router' {
+ interface FileRoutesByPath {
+ '/hub': {
+ id: '/hub'
+ path: '/hub'
+ fullPath: '/hub'
+ preLoaderRoute: typeof HubRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/other': {
+ id: '/other'
+ path: '/other'
+ fullPath: '/other'
+ preLoaderRoute: typeof OtherRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/hub/list': {
+ id: '/hub/list'
+ path: '/list'
+ fullPath: '/hub/list'
+ preLoaderRoute: typeof HubListRouteImport
+ parentRoute: typeof HubRoute
+ }
+ '/hub/detail/$id': {
+ id: '/hub/detail/$id'
+ path: '/detail/$id'
+ fullPath: '/hub/detail/$id'
+ preLoaderRoute: typeof HubDetailIdRouteImport
+ parentRoute: typeof HubRoute
+ }
+ }
+}
+
+interface HubRouteChildren {
+ HubListRoute: typeof HubListRoute
+ HubDetailIdRoute: typeof HubDetailIdRoute
+}
+
+const HubRouteChildren: HubRouteChildren = {
+ HubListRoute: HubListRoute,
+ HubDetailIdRoute: HubDetailIdRoute,
+}
+
+const HubRouteWithChildren = HubRoute._addFileChildren(HubRouteChildren)
+
+const rootRouteChildren: RootRouteChildren = {
+ HubRoute: HubRouteWithChildren,
+ OtherRoute: OtherRoute,
+}
+export const routeTree = rootRouteImport
+ ._addFileChildren(rootRouteChildren)
+ ._addFileTypes()
diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/__root.tsx
new file mode 100644
index 0000000000..a4f7985c5a
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/__root.tsx
@@ -0,0 +1,46 @@
+import * as Vue from 'vue'
+import { Link, Outlet, createRootRoute } from '@tanstack/vue-router'
+import { sortedSearch } from '../../../shared'
+
+const RootComponent = Vue.defineComponent({
+ setup() {
+ return () => (
+ <>
+
+
+ List
+
+
+ List sorted
+
+
+ Detail 1
+
+
+ Detail 2
+
+
+ Other
+
+
+
+ >
+ )
+ },
+})
+
+export const Route = createRootRoute({
+ component: RootComponent,
+})
diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.detail.$id.tsx b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.detail.$id.tsx
new file mode 100644
index 0000000000..4701ab44eb
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.detail.$id.tsx
@@ -0,0 +1,27 @@
+import * as Vue from 'vue'
+import { Link, createFileRoute } from '@tanstack/vue-router'
+import { detailMarker } from '../../../shared'
+
+const DetailPage = Vue.defineComponent({
+ setup() {
+ const params = Route.useParams()
+
+ return () => (
+
+ {detailMarker(params.value.id)}
+ Back to list
+
+ Next
+
+ Elsewhere
+
+ )
+ },
+})
+
+export const Route = createFileRoute('/hub/detail/$id')({
+ component: DetailPage,
+})
diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.list.tsx b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.list.tsx
new file mode 100644
index 0000000000..02abd6db1b
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.list.tsx
@@ -0,0 +1,74 @@
+import * as Vue from 'vue'
+import { Link, createFileRoute } from '@tanstack/vue-router'
+import {
+ listItemIds,
+ listMarker,
+ listRelativeTestId,
+ listSortedMarker,
+} from '../../../shared'
+
+const ascSearch = { sort: 'asc' } as const
+
+// List Links depart whenever the list leaf is left.
+const ListLinks = Vue.defineComponent({
+ setup() {
+ return () => (
+
+ {listItemIds.map((id) => {
+ const page = Number(id)
+ return (
+
+
+ {`Item ${id}`}
+
+
+ {`Item ${id} asc`}
+
+
+ {`Item ${id} exact`}
+
+ ({ ...prev, page })}>
+ {`Page ${id}`}
+
+ ({
+ ...prev,
+ page,
+ sort: 'asc' as const,
+ })}
+ data-testid={id === '1' ? listRelativeTestId : undefined}
+ >
+ {`Page ${id} asc`}
+
+
+ )
+ })}
+
+ )
+ },
+})
+
+const ListPage = Vue.defineComponent({
+ setup() {
+ const sort = Route.useSearch({ select: (search) => search.sort })
+
+ return () => (
+
+
+ {sort.value === 'desc' ? listSortedMarker : listMarker}
+
+
+
+ )
+ },
+})
+
+export const Route = createFileRoute('/hub/list')({
+ component: ListPage,
+})
diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.tsx b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.tsx
new file mode 100644
index 0000000000..5be17f3350
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.tsx
@@ -0,0 +1,69 @@
+import * as Vue from 'vue'
+import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'
+import {
+ hubItemIds,
+ hubRelativeTestId,
+ validateHubSearch,
+} from '../../../shared'
+
+// Layout Links stay mounted while the hub leaves change.
+const HubLinks = Vue.defineComponent({
+ setup() {
+ return () => (
+
+ {hubItemIds.map((id) => {
+ const page = Number(id)
+ return (
+
+
+ {`Detail ${id}`}
+
+
+ {`Detail ${id} exact`}
+
+
+ {`List page ${id}`}
+
+ ({ ...prev, page })}>
+ {`List keep ${id}`}
+
+ ({ ...prev, page })}
+ data-testid={id === '1' ? hubRelativeTestId : undefined}
+ >
+ {`Here page ${id}`}
+
+
+ )
+ })}
+
+ )
+ },
+})
+
+const HubLayout = Vue.defineComponent({
+ setup() {
+ return () => (
+
+ )
+ },
+})
+
+export const Route = createFileRoute('/hub')({
+ validateSearch: validateHubSearch,
+ component: HubLayout,
+})
diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/other.tsx b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/other.tsx
new file mode 100644
index 0000000000..08dec586fa
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/other.tsx
@@ -0,0 +1,17 @@
+import * as Vue from 'vue'
+import { createFileRoute } from '@tanstack/vue-router'
+import { otherMarker } from '../../../shared'
+
+const OtherPage = Vue.defineComponent({
+ setup() {
+ return () => (
+
+ {otherMarker}
+
+ )
+ },
+})
+
+export const Route = createFileRoute('/other')({
+ component: OtherPage,
+})
diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/tsconfig.json b/benchmarks/client-nav/scenarios/link-churn/vue/tsconfig.json
new file mode 100644
index 0000000000..7786fc3da9
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/vue/tsconfig.json
@@ -0,0 +1,21 @@
+{
+ "extends": "../../../../../tsconfig.json",
+ "compilerOptions": {
+ "jsx": "preserve",
+ "jsxImportSource": "vue",
+ "allowImportingTsExtensions": true,
+ "types": ["node", "vite/client", "vitest/globals"]
+ },
+ "include": [
+ "speed.bench.ts",
+ "speed.flame.ts",
+ "setup.ts",
+ "vite.config.ts",
+ "../shared.ts",
+ "../../harness.ts",
+ "../../../setup-helpers.ts",
+ "../../../jsdom.ts",
+ "../../../vitest.setup.ts",
+ "./src/**/*"
+ ]
+}
diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/vite.config.ts b/benchmarks/client-nav/scenarios/link-churn/vue/vite.config.ts
new file mode 100644
index 0000000000..8f56734e04
--- /dev/null
+++ b/benchmarks/client-nav/scenarios/link-churn/vue/vite.config.ts
@@ -0,0 +1,44 @@
+import { fileURLToPath } from 'node:url'
+import { defineConfig } from 'vitest/config'
+import vue from '@vitejs/plugin-vue'
+import vueJsx from '@vitejs/plugin-vue-jsx'
+import codspeedPlugin from '@codspeed/vitest-plugin'
+import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
+
+const rootDir = fileURLToPath(new URL('.', import.meta.url))
+
+export default defineConfig({
+ root: rootDir,
+ define: {
+ 'process.env.NODE_ENV': JSON.stringify('production'),
+ },
+ plugins: [
+ !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&
+ codspeedPlugin(),
+ tanstackRouter({
+ target: 'vue',
+ routesDirectory: `${rootDir}src/routes`,
+ generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
+ }),
+ vue(),
+ vueJsx(),
+ ],
+ build: {
+ outDir: './dist',
+ emptyOutDir: true,
+ minify: false,
+ lib: {
+ entry: './src/main.tsx',
+ formats: ['es'],
+ fileName: 'app',
+ },
+ },
+ test: {
+ execArgv: cpuSimulationExecArgv(),
+ name: '@benchmarks/client-nav link-churn (vue)',
+ watch: false,
+ environment: 'jsdom',
+ setupFiles: ['../../../vitest.setup.ts'],
+ },
+})
diff --git a/benchmarks/client-nav/scenarios/links/react/speed.bench.ts b/benchmarks/client-nav/scenarios/links/react/speed.bench.ts
index 0892308901..75f5f725d4 100644
--- a/benchmarks/client-nav/scenarios/links/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/links/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-links', () => {
- const test = setup()
+test('client-links', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-links navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/links/react/vite.config.ts b/benchmarks/client-nav/scenarios/links/react/vite.config.ts
index 9e9cd48895..69de10b5b7 100644
--- a/benchmarks/client-nav/scenarios/links/react/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/links/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -32,6 +33,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav links (react)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/links/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/links/solid/speed.bench.ts
index a3d690b423..fc7f3e71e7 100644
--- a/benchmarks/client-nav/scenarios/links/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/links/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-links', () => {
- const test = setup()
+test('client-links', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-links navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/links/solid/src/main.tsx b/benchmarks/client-nav/scenarios/links/solid/src/main.tsx
index f7148011f5..fa9d239418 100644
--- a/benchmarks/client-nav/scenarios/links/solid/src/main.tsx
+++ b/benchmarks/client-nav/scenarios/links/solid/src/main.tsx
@@ -1,5 +1,5 @@
import type { RouterHistory } from '@tanstack/history'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { RouterProvider, createRouter } from '@tanstack/solid-router'
import { routeTree } from './routeTree.gen'
diff --git a/benchmarks/client-nav/scenarios/links/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/links/solid/src/routeTree.gen.ts
index b61431e40d..0da70513e8 100644
--- a/benchmarks/client-nav/scenarios/links/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/links/solid/src/routeTree.gen.ts
@@ -9,20 +9,20 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as AboutRouteImport } from './routes/about'
import { Route as IndexRouteImport } from './routes/index'
+import { Route as AboutRouteImport } from './routes/about'
import { Route as ItemsIdRouteImport } from './routes/items.$id'
-const AboutRoute = AboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
+const AboutRoute = AboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ItemsIdRoute = ItemsIdRouteImport.update({
id: '/items/$id',
path: '/items/$id',
@@ -61,13 +61,6 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/about': {
- id: '/about'
- path: '/about'
- fullPath: '/about'
- preLoaderRoute: typeof AboutRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -75,6 +68,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
+ '/about': {
+ id: '/about'
+ path: '/about'
+ fullPath: '/about'
+ preLoaderRoute: typeof AboutRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/items/$id': {
id: '/items/$id'
path: '/items/$id'
diff --git a/benchmarks/client-nav/scenarios/links/solid/tsconfig.json b/benchmarks/client-nav/scenarios/links/solid/tsconfig.json
index 8c57ff876a..98d76ad6b8 100644
--- a/benchmarks/client-nav/scenarios/links/solid/tsconfig.json
+++ b/benchmarks/client-nav/scenarios/links/solid/tsconfig.json
@@ -2,7 +2,7 @@
"extends": "../../../../../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"allowImportingTsExtensions": true,
"types": ["node", "vite/client", "vitest/globals"]
},
diff --git a/benchmarks/client-nav/scenarios/links/solid/vite.config.ts b/benchmarks/client-nav/scenarios/links/solid/vite.config.ts
index 7a0bb18aee..e37342ffc3 100644
--- a/benchmarks/client-nav/scenarios/links/solid/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/links/solid/vite.config.ts
@@ -1,8 +1,9 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -19,7 +20,7 @@ export default defineConfig({
routesDirectory: `${rootDir}src/routes`,
generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
}),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -35,6 +36,7 @@ export default defineConfig({
conditions: ['solid', 'browser'],
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav links (solid)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/links/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/links/vue/speed.bench.ts
index e2d3f7c47a..2ace7a8409 100644
--- a/benchmarks/client-nav/scenarios/links/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/links/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-links', () => {
- const test = setup()
+test('client-links', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-links navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/links/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/links/vue/src/routeTree.gen.ts
index cee64be43c..7d2b1e9bbb 100644
--- a/benchmarks/client-nav/scenarios/links/vue/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/links/vue/src/routeTree.gen.ts
@@ -9,20 +9,20 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as AboutRouteImport } from './routes/about'
import { Route as IndexRouteImport } from './routes/index'
+import { Route as AboutRouteImport } from './routes/about'
import { Route as ItemsIdRouteImport } from './routes/items.$id'
-const AboutRoute = AboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
+const AboutRoute = AboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ItemsIdRoute = ItemsIdRouteImport.update({
id: '/items/$id',
path: '/items/$id',
@@ -61,13 +61,6 @@ export interface RootRouteChildren {
declare module '@tanstack/vue-router' {
interface FileRoutesByPath {
- '/about': {
- id: '/about'
- path: '/about'
- fullPath: '/about'
- preLoaderRoute: typeof AboutRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -75,6 +68,13 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
+ '/about': {
+ id: '/about'
+ path: '/about'
+ fullPath: '/about'
+ preLoaderRoute: typeof AboutRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/items/$id': {
id: '/items/$id'
path: '/items/$id'
diff --git a/benchmarks/client-nav/scenarios/links/vue/vite.config.ts b/benchmarks/client-nav/scenarios/links/vue/vite.config.ts
index d1cf9f561d..ad89a49d70 100644
--- a/benchmarks/client-nav/scenarios/links/vue/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/links/vue/vite.config.ts
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -34,6 +35,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav links (vue)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts b/benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts
index f5a51b29be..8bcc53b88e 100644
--- a/benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-loaders', () => {
- const test = setup()
+test('client-loaders', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-loaders navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/loaders/react/vite.config.ts b/benchmarks/client-nav/scenarios/loaders/react/vite.config.ts
index 6fa28bcd35..818b224130 100644
--- a/benchmarks/client-nav/scenarios/loaders/react/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/loaders/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -32,6 +33,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav loaders (react)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts
index 9f3bd397db..953a17b31a 100644
--- a/benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-loaders', () => {
- const test = setup()
+test('client-loaders', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-loaders navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx b/benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx
index f7148011f5..fa9d239418 100644
--- a/benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx
+++ b/benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx
@@ -1,5 +1,5 @@
import type { RouterHistory } from '@tanstack/history'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { RouterProvider, createRouter } from '@tanstack/solid-router'
import { routeTree } from './routeTree.gen'
diff --git a/benchmarks/client-nav/scenarios/loaders/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/loaders/solid/src/routeTree.gen.ts
index bdec400237..fa5d032141 100644
--- a/benchmarks/client-nav/scenarios/loaders/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/loaders/solid/src/routeTree.gen.ts
@@ -9,24 +9,19 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as DepsRouteImport } from './routes/deps'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as FreshIdRouteImport } from './routes/fresh.$id'
+import { Route as DepsRouteImport } from './routes/deps'
import { Route as CachedIdRouteImport } from './routes/cached.$id'
+import { Route as FreshIdRouteImport } from './routes/fresh.$id'
-const DepsRoute = DepsRouteImport.update({
- id: '/deps',
- path: '/deps',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const FreshIdRoute = FreshIdRouteImport.update({
- id: '/fresh/$id',
- path: '/fresh/$id',
+const DepsRoute = DepsRouteImport.update({
+ id: '/deps',
+ path: '/deps',
getParentRoute: () => rootRouteImport,
} as any)
const CachedIdRoute = CachedIdRouteImport.update({
@@ -34,6 +29,11 @@ const CachedIdRoute = CachedIdRouteImport.update({
path: '/cached/$id',
getParentRoute: () => rootRouteImport,
} as any)
+const FreshIdRoute = FreshIdRouteImport.update({
+ id: '/fresh/$id',
+ path: '/fresh/$id',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -71,13 +71,6 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/deps': {
- id: '/deps'
- path: '/deps'
- fullPath: '/deps'
- preLoaderRoute: typeof DepsRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -85,11 +78,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
- '/fresh/$id': {
- id: '/fresh/$id'
- path: '/fresh/$id'
- fullPath: '/fresh/$id'
- preLoaderRoute: typeof FreshIdRouteImport
+ '/deps': {
+ id: '/deps'
+ path: '/deps'
+ fullPath: '/deps'
+ preLoaderRoute: typeof DepsRouteImport
parentRoute: typeof rootRouteImport
}
'/cached/$id': {
@@ -99,6 +92,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof CachedIdRouteImport
parentRoute: typeof rootRouteImport
}
+ '/fresh/$id': {
+ id: '/fresh/$id'
+ path: '/fresh/$id'
+ fullPath: '/fresh/$id'
+ preLoaderRoute: typeof FreshIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
}
}
diff --git a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/cached.$id.tsx b/benchmarks/client-nav/scenarios/loaders/solid/src/routes/cached.$id.tsx
index 4838141b22..aab6be74dc 100644
--- a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/cached.$id.tsx
+++ b/benchmarks/client-nav/scenarios/loaders/solid/src/routes/cached.$id.tsx
@@ -15,12 +15,9 @@ export const Route = createFileRoute('/cached/$id')({
const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index)
function PerfValue(props: { value: () => number }) {
- createRenderEffect(
- () => {
- void props.value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void props.value()
+ })
return null
}
diff --git a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/deps.tsx b/benchmarks/client-nav/scenarios/loaders/solid/src/routes/deps.tsx
index 258c7bc23b..2f23f2d3da 100644
--- a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/deps.tsx
+++ b/benchmarks/client-nav/scenarios/loaders/solid/src/routes/deps.tsx
@@ -25,12 +25,9 @@ export const Route = createFileRoute('/deps')({
const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index)
function PerfValue(props: { value: () => number }) {
- createRenderEffect(
- () => {
- void props.value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void props.value()
+ })
return null
}
diff --git a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/fresh.$id.tsx b/benchmarks/client-nav/scenarios/loaders/solid/src/routes/fresh.$id.tsx
index 29bc35a650..acd6a9aa27 100644
--- a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/fresh.$id.tsx
+++ b/benchmarks/client-nav/scenarios/loaders/solid/src/routes/fresh.$id.tsx
@@ -15,12 +15,9 @@ export const Route = createFileRoute('/fresh/$id')({
const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index)
function PerfValue(props: { value: () => number }) {
- createRenderEffect(
- () => {
- void props.value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void props.value()
+ })
return null
}
diff --git a/benchmarks/client-nav/scenarios/loaders/solid/tsconfig.json b/benchmarks/client-nav/scenarios/loaders/solid/tsconfig.json
index 8c57ff876a..98d76ad6b8 100644
--- a/benchmarks/client-nav/scenarios/loaders/solid/tsconfig.json
+++ b/benchmarks/client-nav/scenarios/loaders/solid/tsconfig.json
@@ -2,7 +2,7 @@
"extends": "../../../../../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"allowImportingTsExtensions": true,
"types": ["node", "vite/client", "vitest/globals"]
},
diff --git a/benchmarks/client-nav/scenarios/loaders/solid/vite.config.ts b/benchmarks/client-nav/scenarios/loaders/solid/vite.config.ts
index 723e95e181..90584d3b7e 100644
--- a/benchmarks/client-nav/scenarios/loaders/solid/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/loaders/solid/vite.config.ts
@@ -1,8 +1,9 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -19,7 +20,7 @@ export default defineConfig({
routesDirectory: `${rootDir}src/routes`,
generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
}),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -35,6 +36,7 @@ export default defineConfig({
conditions: ['solid', 'browser'],
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav loaders (solid)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts
index 819fe020b0..1ae2f89a56 100644
--- a/benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-loaders', () => {
- const test = setup()
+test('client-loaders', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-loaders navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/loaders/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/loaders/vue/src/routeTree.gen.ts
index 25a82df477..10cb8f2aca 100644
--- a/benchmarks/client-nav/scenarios/loaders/vue/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/loaders/vue/src/routeTree.gen.ts
@@ -9,24 +9,19 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as DepsRouteImport } from './routes/deps'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as FreshIdRouteImport } from './routes/fresh.$id'
+import { Route as DepsRouteImport } from './routes/deps'
import { Route as CachedIdRouteImport } from './routes/cached.$id'
+import { Route as FreshIdRouteImport } from './routes/fresh.$id'
-const DepsRoute = DepsRouteImport.update({
- id: '/deps',
- path: '/deps',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const FreshIdRoute = FreshIdRouteImport.update({
- id: '/fresh/$id',
- path: '/fresh/$id',
+const DepsRoute = DepsRouteImport.update({
+ id: '/deps',
+ path: '/deps',
getParentRoute: () => rootRouteImport,
} as any)
const CachedIdRoute = CachedIdRouteImport.update({
@@ -34,6 +29,11 @@ const CachedIdRoute = CachedIdRouteImport.update({
path: '/cached/$id',
getParentRoute: () => rootRouteImport,
} as any)
+const FreshIdRoute = FreshIdRouteImport.update({
+ id: '/fresh/$id',
+ path: '/fresh/$id',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -71,13 +71,6 @@ export interface RootRouteChildren {
declare module '@tanstack/vue-router' {
interface FileRoutesByPath {
- '/deps': {
- id: '/deps'
- path: '/deps'
- fullPath: '/deps'
- preLoaderRoute: typeof DepsRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -85,11 +78,11 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
- '/fresh/$id': {
- id: '/fresh/$id'
- path: '/fresh/$id'
- fullPath: '/fresh/$id'
- preLoaderRoute: typeof FreshIdRouteImport
+ '/deps': {
+ id: '/deps'
+ path: '/deps'
+ fullPath: '/deps'
+ preLoaderRoute: typeof DepsRouteImport
parentRoute: typeof rootRouteImport
}
'/cached/$id': {
@@ -99,6 +92,13 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof CachedIdRouteImport
parentRoute: typeof rootRouteImport
}
+ '/fresh/$id': {
+ id: '/fresh/$id'
+ path: '/fresh/$id'
+ fullPath: '/fresh/$id'
+ preLoaderRoute: typeof FreshIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
}
}
diff --git a/benchmarks/client-nav/scenarios/loaders/vue/vite.config.ts b/benchmarks/client-nav/scenarios/loaders/vue/vite.config.ts
index 350fadf387..ecf4cce139 100644
--- a/benchmarks/client-nav/scenarios/loaders/vue/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/loaders/vue/vite.config.ts
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -34,6 +35,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav loaders (vue)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/mount/react/speed.bench.ts b/benchmarks/client-nav/scenarios/mount/react/speed.bench.ts
index 2d675ff259..6c3a64b026 100644
--- a/benchmarks/client-nav/scenarios/mount/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/mount/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-mount', () => {
- const test = setup()
+test('client-mount', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-mount loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/mount/react/vite.config.ts b/benchmarks/client-nav/scenarios/mount/react/vite.config.ts
index 68ee46738a..e197d33a9e 100644
--- a/benchmarks/client-nav/scenarios/mount/react/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/mount/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -32,6 +33,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav mount (react)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts
index eaf7f1ed34..236f875f57 100644
--- a/benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-mount', () => {
- const test = setup()
+test('client-mount', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-mount loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/main.tsx b/benchmarks/client-nav/scenarios/mount/solid/src/main.tsx
index bd29324154..2586872f5c 100644
--- a/benchmarks/client-nav/scenarios/mount/solid/src/main.tsx
+++ b/benchmarks/client-nav/scenarios/mount/solid/src/main.tsx
@@ -1,4 +1,4 @@
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { RouterProvider, createRouter } from '@tanstack/solid-router'
import { routeTree } from './routeTree.gen'
import type { RouterHistory } from '@tanstack/history'
diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/mount/solid/src/routeTree.gen.ts
index dc0acc183d..30247636dd 100644
--- a/benchmarks/client-nav/scenarios/mount/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/mount/solid/src/routeTree.gen.ts
@@ -9,35 +9,20 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as ShopRouteImport } from './routes/shop'
-import { Route as SettingsRouteImport } from './routes/settings'
-import { Route as SearchRouteImport } from './routes/search'
-import { Route as BlogRouteImport } from './routes/blog'
-import { Route as AboutRouteImport } from './routes/about'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as ShopIndexRouteImport } from './routes/shop.index'
+import { Route as AboutRouteImport } from './routes/about'
+import { Route as BlogRouteImport } from './routes/blog'
+import { Route as SearchRouteImport } from './routes/search'
+import { Route as SettingsRouteImport } from './routes/settings'
+import { Route as ShopRouteImport } from './routes/shop'
import { Route as BlogIndexRouteImport } from './routes/blog.index'
-import { Route as ShopProductIdRouteImport } from './routes/shop.$productId'
import { Route as BlogSlugRouteImport } from './routes/blog.$slug'
+import { Route as ShopIndexRouteImport } from './routes/shop.index'
+import { Route as ShopProductIdRouteImport } from './routes/shop.$productId'
-const ShopRoute = ShopRouteImport.update({
- id: '/shop',
- path: '/shop',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SettingsRoute = SettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SearchRoute = SearchRouteImport.update({
- id: '/search',
- path: '/search',
- getParentRoute: () => rootRouteImport,
-} as any)
-const BlogRoute = BlogRouteImport.update({
- id: '/blog',
- path: '/blog',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const AboutRoute = AboutRouteImport.update({
@@ -45,31 +30,46 @@ const AboutRoute = AboutRouteImport.update({
path: '/about',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const BlogRoute = BlogRouteImport.update({
+ id: '/blog',
+ path: '/blog',
getParentRoute: () => rootRouteImport,
} as any)
-const ShopIndexRoute = ShopIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => ShopRoute,
+const SearchRoute = SearchRouteImport.update({
+ id: '/search',
+ path: '/search',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const SettingsRoute = SettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ShopRoute = ShopRouteImport.update({
+ id: '/shop',
+ path: '/shop',
+ getParentRoute: () => rootRouteImport,
} as any)
const BlogIndexRoute = BlogIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => BlogRoute,
} as any)
-const ShopProductIdRoute = ShopProductIdRouteImport.update({
- id: '/$productId',
- path: '/$productId',
- getParentRoute: () => ShopRoute,
-} as any)
const BlogSlugRoute = BlogSlugRouteImport.update({
id: '/$slug',
path: '/$slug',
getParentRoute: () => BlogRoute,
} as any)
+const ShopIndexRoute = ShopIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => ShopRoute,
+} as any)
+const ShopProductIdRoute = ShopProductIdRouteImport.update({
+ id: '/$productId',
+ path: '/$productId',
+ getParentRoute: () => ShopRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -154,32 +154,11 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/shop': {
- id: '/shop'
- path: '/shop'
- fullPath: '/shop'
- preLoaderRoute: typeof ShopRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/settings': {
- id: '/settings'
- path: '/settings'
- fullPath: '/settings'
- preLoaderRoute: typeof SettingsRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/search': {
- id: '/search'
- path: '/search'
- fullPath: '/search'
- preLoaderRoute: typeof SearchRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/blog': {
- id: '/blog'
- path: '/blog'
- fullPath: '/blog'
- preLoaderRoute: typeof BlogRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/about': {
@@ -189,19 +168,33 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof AboutRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/blog': {
+ id: '/blog'
+ path: '/blog'
+ fullPath: '/blog'
+ preLoaderRoute: typeof BlogRouteImport
parentRoute: typeof rootRouteImport
}
- '/shop/': {
- id: '/shop/'
- path: '/'
- fullPath: '/shop/'
- preLoaderRoute: typeof ShopIndexRouteImport
- parentRoute: typeof ShopRoute
+ '/search': {
+ id: '/search'
+ path: '/search'
+ fullPath: '/search'
+ preLoaderRoute: typeof SearchRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/settings': {
+ id: '/settings'
+ path: '/settings'
+ fullPath: '/settings'
+ preLoaderRoute: typeof SettingsRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/shop': {
+ id: '/shop'
+ path: '/shop'
+ fullPath: '/shop'
+ preLoaderRoute: typeof ShopRouteImport
+ parentRoute: typeof rootRouteImport
}
'/blog/': {
id: '/blog/'
@@ -210,13 +203,6 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof BlogIndexRouteImport
parentRoute: typeof BlogRoute
}
- '/shop/$productId': {
- id: '/shop/$productId'
- path: '/$productId'
- fullPath: '/shop/$productId'
- preLoaderRoute: typeof ShopProductIdRouteImport
- parentRoute: typeof ShopRoute
- }
'/blog/$slug': {
id: '/blog/$slug'
path: '/$slug'
@@ -224,6 +210,20 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof BlogSlugRouteImport
parentRoute: typeof BlogRoute
}
+ '/shop/': {
+ id: '/shop/'
+ path: '/'
+ fullPath: '/shop/'
+ preLoaderRoute: typeof ShopIndexRouteImport
+ parentRoute: typeof ShopRoute
+ }
+ '/shop/$productId': {
+ id: '/shop/$productId'
+ path: '/$productId'
+ fullPath: '/shop/$productId'
+ preLoaderRoute: typeof ShopProductIdRouteImport
+ parentRoute: typeof ShopRoute
+ }
}
}
diff --git a/benchmarks/client-nav/scenarios/mount/solid/tsconfig.json b/benchmarks/client-nav/scenarios/mount/solid/tsconfig.json
index 8c57ff876a..98d76ad6b8 100644
--- a/benchmarks/client-nav/scenarios/mount/solid/tsconfig.json
+++ b/benchmarks/client-nav/scenarios/mount/solid/tsconfig.json
@@ -2,7 +2,7 @@
"extends": "../../../../../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"allowImportingTsExtensions": true,
"types": ["node", "vite/client", "vitest/globals"]
},
diff --git a/benchmarks/client-nav/scenarios/mount/solid/vite.config.ts b/benchmarks/client-nav/scenarios/mount/solid/vite.config.ts
index 0669a8052d..5b586dd128 100644
--- a/benchmarks/client-nav/scenarios/mount/solid/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/mount/solid/vite.config.ts
@@ -1,8 +1,9 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -19,7 +20,7 @@ export default defineConfig({
routesDirectory: `${rootDir}src/routes`,
generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
}),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -35,6 +36,7 @@ export default defineConfig({
conditions: ['solid', 'browser'],
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav mount (solid)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts
index f5538dd49c..d9268ba91b 100644
--- a/benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts
@@ -1,32 +1,15 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-mount', () => {
- const test = setup()
+test('client-mount', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
- 'client-mount loop (vue)',
- async () => {
- for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
- }
- await test.finishBatch()
- },
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ await bench('client-mount loop (vue)', benchLifecycle(scenario), async () => {
+ for (let i = 0; i < ticksPerIteration; i++) {
+ await scenario.tick()
+ }
+ await scenario.finishBatch()
+ }).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/mount/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/mount/vue/src/routeTree.gen.ts
index 98643d63c9..cd27c917e1 100644
--- a/benchmarks/client-nav/scenarios/mount/vue/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/mount/vue/src/routeTree.gen.ts
@@ -9,35 +9,20 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as ShopRouteImport } from './routes/shop'
-import { Route as SettingsRouteImport } from './routes/settings'
-import { Route as SearchRouteImport } from './routes/search'
-import { Route as BlogRouteImport } from './routes/blog'
-import { Route as AboutRouteImport } from './routes/about'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as ShopIndexRouteImport } from './routes/shop.index'
+import { Route as AboutRouteImport } from './routes/about'
+import { Route as BlogRouteImport } from './routes/blog'
+import { Route as SearchRouteImport } from './routes/search'
+import { Route as SettingsRouteImport } from './routes/settings'
+import { Route as ShopRouteImport } from './routes/shop'
import { Route as BlogIndexRouteImport } from './routes/blog.index'
-import { Route as ShopProductIdRouteImport } from './routes/shop.$productId'
import { Route as BlogSlugRouteImport } from './routes/blog.$slug'
+import { Route as ShopIndexRouteImport } from './routes/shop.index'
+import { Route as ShopProductIdRouteImport } from './routes/shop.$productId'
-const ShopRoute = ShopRouteImport.update({
- id: '/shop',
- path: '/shop',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SettingsRoute = SettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SearchRoute = SearchRouteImport.update({
- id: '/search',
- path: '/search',
- getParentRoute: () => rootRouteImport,
-} as any)
-const BlogRoute = BlogRouteImport.update({
- id: '/blog',
- path: '/blog',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const AboutRoute = AboutRouteImport.update({
@@ -45,31 +30,46 @@ const AboutRoute = AboutRouteImport.update({
path: '/about',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const BlogRoute = BlogRouteImport.update({
+ id: '/blog',
+ path: '/blog',
getParentRoute: () => rootRouteImport,
} as any)
-const ShopIndexRoute = ShopIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => ShopRoute,
+const SearchRoute = SearchRouteImport.update({
+ id: '/search',
+ path: '/search',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const SettingsRoute = SettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ShopRoute = ShopRouteImport.update({
+ id: '/shop',
+ path: '/shop',
+ getParentRoute: () => rootRouteImport,
} as any)
const BlogIndexRoute = BlogIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => BlogRoute,
} as any)
-const ShopProductIdRoute = ShopProductIdRouteImport.update({
- id: '/$productId',
- path: '/$productId',
- getParentRoute: () => ShopRoute,
-} as any)
const BlogSlugRoute = BlogSlugRouteImport.update({
id: '/$slug',
path: '/$slug',
getParentRoute: () => BlogRoute,
} as any)
+const ShopIndexRoute = ShopIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => ShopRoute,
+} as any)
+const ShopProductIdRoute = ShopProductIdRouteImport.update({
+ id: '/$productId',
+ path: '/$productId',
+ getParentRoute: () => ShopRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -154,32 +154,11 @@ export interface RootRouteChildren {
declare module '@tanstack/vue-router' {
interface FileRoutesByPath {
- '/shop': {
- id: '/shop'
- path: '/shop'
- fullPath: '/shop'
- preLoaderRoute: typeof ShopRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/settings': {
- id: '/settings'
- path: '/settings'
- fullPath: '/settings'
- preLoaderRoute: typeof SettingsRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/search': {
- id: '/search'
- path: '/search'
- fullPath: '/search'
- preLoaderRoute: typeof SearchRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/blog': {
- id: '/blog'
- path: '/blog'
- fullPath: '/blog'
- preLoaderRoute: typeof BlogRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/about': {
@@ -189,19 +168,33 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof AboutRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/blog': {
+ id: '/blog'
+ path: '/blog'
+ fullPath: '/blog'
+ preLoaderRoute: typeof BlogRouteImport
parentRoute: typeof rootRouteImport
}
- '/shop/': {
- id: '/shop/'
- path: '/'
- fullPath: '/shop/'
- preLoaderRoute: typeof ShopIndexRouteImport
- parentRoute: typeof ShopRoute
+ '/search': {
+ id: '/search'
+ path: '/search'
+ fullPath: '/search'
+ preLoaderRoute: typeof SearchRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/settings': {
+ id: '/settings'
+ path: '/settings'
+ fullPath: '/settings'
+ preLoaderRoute: typeof SettingsRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/shop': {
+ id: '/shop'
+ path: '/shop'
+ fullPath: '/shop'
+ preLoaderRoute: typeof ShopRouteImport
+ parentRoute: typeof rootRouteImport
}
'/blog/': {
id: '/blog/'
@@ -210,13 +203,6 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof BlogIndexRouteImport
parentRoute: typeof BlogRoute
}
- '/shop/$productId': {
- id: '/shop/$productId'
- path: '/$productId'
- fullPath: '/shop/$productId'
- preLoaderRoute: typeof ShopProductIdRouteImport
- parentRoute: typeof ShopRoute
- }
'/blog/$slug': {
id: '/blog/$slug'
path: '/$slug'
@@ -224,6 +210,20 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof BlogSlugRouteImport
parentRoute: typeof BlogRoute
}
+ '/shop/': {
+ id: '/shop/'
+ path: '/'
+ fullPath: '/shop/'
+ preLoaderRoute: typeof ShopIndexRouteImport
+ parentRoute: typeof ShopRoute
+ }
+ '/shop/$productId': {
+ id: '/shop/$productId'
+ path: '/$productId'
+ fullPath: '/shop/$productId'
+ preLoaderRoute: typeof ShopProductIdRouteImport
+ parentRoute: typeof ShopRoute
+ }
}
}
diff --git a/benchmarks/client-nav/scenarios/mount/vue/vite.config.ts b/benchmarks/client-nav/scenarios/mount/vue/vite.config.ts
index 107e1037b6..8d4005f339 100644
--- a/benchmarks/client-nav/scenarios/mount/vue/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/mount/vue/vite.config.ts
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -34,6 +35,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav mount (vue)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts b/benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts
index 3dfe93c117..fa5809c1fd 100644
--- a/benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-nested-params', () => {
- const test = setup()
+test('client-nested-params', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-nested-params navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/nested-params/react/vite.config.ts b/benchmarks/client-nav/scenarios/nested-params/react/vite.config.ts
index 672b1850ff..a99060bf1c 100644
--- a/benchmarks/client-nav/scenarios/nested-params/react/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/nested-params/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -32,6 +33,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav nested-params (react)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts
index dc7ec11f6b..2c64d9a221 100644
--- a/benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-nested-params', () => {
- const test = setup()
+test('client-nested-params', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-nested-params navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx
index f7148011f5..fa9d239418 100644
--- a/benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx
+++ b/benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx
@@ -1,5 +1,5 @@
import type { RouterHistory } from '@tanstack/history'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { RouterProvider, createRouter } from '@tanstack/solid-router'
import { routeTree } from './routeTree.gen'
diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.$g.$h.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.$g.$h.tsx
index fccc6ca7bb..7dc55db0e4 100644
--- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.$g.$h.tsx
+++ b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.$g.$h.tsx
@@ -13,12 +13,9 @@ export const Route = createFileRoute('/l/$a/$b/$c/$d/$e/$f/$g/$h')({
function ParamsSubscriberOne() {
const value = Route.useParams({ select: (params) => smallHash(params.h) })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -26,23 +23,17 @@ function ParamsSubscriberTwo() {
const value = Route.useParams({
select: (params) => smallHash(`${params.h}:2`),
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
function ContextSubscriberOne() {
const value = Route.useRouteContext({ select: (context) => context.ctxH })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -50,12 +41,9 @@ function ContextSubscriberTwo() {
const value = Route.useRouteContext({
select: (context) => (context.ctxH * 31 + 7) >>> 0,
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.$g.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.$g.tsx
index 7274a19aac..d9c6c9429b 100644
--- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.$g.tsx
+++ b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.$g.tsx
@@ -13,12 +13,9 @@ export const Route = createFileRoute('/l/$a/$b/$c/$d/$e/$f/$g')({
function ParamsSubscriberOne() {
const value = Route.useParams({ select: (params) => smallHash(params.g) })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -26,23 +23,17 @@ function ParamsSubscriberTwo() {
const value = Route.useParams({
select: (params) => smallHash(`${params.g}:2`),
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
function ContextSubscriberOne() {
const value = Route.useRouteContext({ select: (context) => context.ctxG })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -50,12 +41,9 @@ function ContextSubscriberTwo() {
const value = Route.useRouteContext({
select: (context) => (context.ctxG * 31 + 7) >>> 0,
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.tsx
index a7ec5597f7..010f89bc4d 100644
--- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.tsx
+++ b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.tsx
@@ -13,12 +13,9 @@ export const Route = createFileRoute('/l/$a/$b/$c/$d/$e/$f')({
function ParamsSubscriberOne() {
const value = Route.useParams({ select: (params) => smallHash(params.f) })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -26,23 +23,17 @@ function ParamsSubscriberTwo() {
const value = Route.useParams({
select: (params) => smallHash(`${params.f}:2`),
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
function ContextSubscriberOne() {
const value = Route.useRouteContext({ select: (context) => context.ctxF })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -50,12 +41,9 @@ function ContextSubscriberTwo() {
const value = Route.useRouteContext({
select: (context) => (context.ctxF * 31 + 7) >>> 0,
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.tsx
index 79c6b118e0..08c107f0c6 100644
--- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.tsx
+++ b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.tsx
@@ -13,12 +13,9 @@ export const Route = createFileRoute('/l/$a/$b/$c/$d/$e')({
function ParamsSubscriberOne() {
const value = Route.useParams({ select: (params) => smallHash(params.e) })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -26,23 +23,17 @@ function ParamsSubscriberTwo() {
const value = Route.useParams({
select: (params) => smallHash(`${params.e}:2`),
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
function ContextSubscriberOne() {
const value = Route.useRouteContext({ select: (context) => context.ctxE })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -50,12 +41,9 @@ function ContextSubscriberTwo() {
const value = Route.useRouteContext({
select: (context) => (context.ctxE * 31 + 7) >>> 0,
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.tsx
index e0dc4c10d2..1b64edd58b 100644
--- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.tsx
+++ b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.tsx
@@ -13,12 +13,9 @@ export const Route = createFileRoute('/l/$a/$b/$c/$d')({
function ParamsSubscriberOne() {
const value = Route.useParams({ select: (params) => smallHash(params.d) })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -26,23 +23,17 @@ function ParamsSubscriberTwo() {
const value = Route.useParams({
select: (params) => smallHash(`${params.d}:2`),
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
function ContextSubscriberOne() {
const value = Route.useRouteContext({ select: (context) => context.ctxD })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -50,12 +41,9 @@ function ContextSubscriberTwo() {
const value = Route.useRouteContext({
select: (context) => (context.ctxD * 31 + 7) >>> 0,
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.tsx
index 3a0df7eb71..e509ea82c6 100644
--- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.tsx
+++ b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.tsx
@@ -13,12 +13,9 @@ export const Route = createFileRoute('/l/$a/$b/$c')({
function ParamsSubscriberOne() {
const value = Route.useParams({ select: (params) => smallHash(params.c) })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -26,23 +23,17 @@ function ParamsSubscriberTwo() {
const value = Route.useParams({
select: (params) => smallHash(`${params.c}:2`),
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
function ContextSubscriberOne() {
const value = Route.useRouteContext({ select: (context) => context.ctxC })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -50,12 +41,9 @@ function ContextSubscriberTwo() {
const value = Route.useRouteContext({
select: (context) => (context.ctxC * 31 + 7) >>> 0,
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.tsx
index 6133e72b48..ada853b845 100644
--- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.tsx
+++ b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.tsx
@@ -13,12 +13,9 @@ export const Route = createFileRoute('/l/$a/$b')({
function ParamsSubscriberOne() {
const value = Route.useParams({ select: (params) => smallHash(params.b) })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -26,23 +23,17 @@ function ParamsSubscriberTwo() {
const value = Route.useParams({
select: (params) => smallHash(`${params.b}:2`),
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
function ContextSubscriberOne() {
const value = Route.useRouteContext({ select: (context) => context.ctxB })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -50,12 +41,9 @@ function ContextSubscriberTwo() {
const value = Route.useRouteContext({
select: (context) => (context.ctxB * 31 + 7) >>> 0,
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.tsx
index 7bd378431b..5ecf004fae 100644
--- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.tsx
+++ b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.tsx
@@ -13,12 +13,9 @@ export const Route = createFileRoute('/l/$a')({
function ParamsSubscriberOne() {
const value = Route.useParams({ select: (params) => smallHash(params.a) })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -26,23 +23,17 @@ function ParamsSubscriberTwo() {
const value = Route.useParams({
select: (params) => smallHash(`${params.a}:2`),
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
function ContextSubscriberOne() {
const value = Route.useRouteContext({ select: (context) => context.ctxA })
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
@@ -50,12 +41,9 @@ function ContextSubscriberTwo() {
const value = Route.useRouteContext({
select: (context) => (context.ctxA * 31 + 7) >>> 0,
})
- createRenderEffect(
- () => {
- void value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void value()
+ })
return null
}
diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/tsconfig.json b/benchmarks/client-nav/scenarios/nested-params/solid/tsconfig.json
index 8c57ff876a..98d76ad6b8 100644
--- a/benchmarks/client-nav/scenarios/nested-params/solid/tsconfig.json
+++ b/benchmarks/client-nav/scenarios/nested-params/solid/tsconfig.json
@@ -2,7 +2,7 @@
"extends": "../../../../../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"allowImportingTsExtensions": true,
"types": ["node", "vite/client", "vitest/globals"]
},
diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/vite.config.ts b/benchmarks/client-nav/scenarios/nested-params/solid/vite.config.ts
index 12ce6954aa..9897e2c199 100644
--- a/benchmarks/client-nav/scenarios/nested-params/solid/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/nested-params/solid/vite.config.ts
@@ -1,8 +1,9 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -19,7 +20,7 @@ export default defineConfig({
routesDirectory: `${rootDir}src/routes`,
generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
}),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -35,6 +36,7 @@ export default defineConfig({
conditions: ['solid', 'browser'],
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav nested-params (solid)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts
index fcb336d1db..bd3e82e070 100644
--- a/benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-nested-params', () => {
- const test = setup()
+test('client-nested-params', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-nested-params navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/vite.config.ts b/benchmarks/client-nav/scenarios/nested-params/vue/vite.config.ts
index 59a4af48ef..0d74eb7a7c 100644
--- a/benchmarks/client-nav/scenarios/nested-params/vue/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/nested-params/vue/vite.config.ts
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -34,6 +35,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav nested-params (vue)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/preload/react/speed.bench.ts b/benchmarks/client-nav/scenarios/preload/react/speed.bench.ts
index 5b188a0a0b..5c210b2fd7 100644
--- a/benchmarks/client-nav/scenarios/preload/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/preload/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-preload', () => {
- const test = setup()
+test('client-preload', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-preload interaction loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/preload/react/vite.config.ts b/benchmarks/client-nav/scenarios/preload/react/vite.config.ts
index ff51686959..8a41fc8707 100644
--- a/benchmarks/client-nav/scenarios/preload/react/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/preload/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -32,6 +33,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav preload (react)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts
index 267c9fd41d..f835b4a7b9 100644
--- a/benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-preload', () => {
- const test = setup()
+test('client-preload', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-preload interaction loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/preload/solid/src/main.tsx b/benchmarks/client-nav/scenarios/preload/solid/src/main.tsx
index ad7e065f2e..3791156c64 100644
--- a/benchmarks/client-nav/scenarios/preload/solid/src/main.tsx
+++ b/benchmarks/client-nav/scenarios/preload/solid/src/main.tsx
@@ -1,5 +1,5 @@
import type { RouterHistory } from '@tanstack/history'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { RouterProvider, createRouter } from '@tanstack/solid-router'
import { routeTree } from './routeTree.gen'
diff --git a/benchmarks/client-nav/scenarios/preload/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/preload/solid/src/routeTree.gen.ts
index 645d925238..97e215b6da 100644
--- a/benchmarks/client-nav/scenarios/preload/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/preload/solid/src/routeTree.gen.ts
@@ -9,20 +9,20 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as DocsRouteImport } from './routes/docs'
import { Route as IndexRouteImport } from './routes/index'
+import { Route as DocsRouteImport } from './routes/docs'
import { Route as SectionsSectionRouteImport } from './routes/sections.$section'
-const DocsRoute = DocsRouteImport.update({
- id: '/docs',
- path: '/docs',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
+const DocsRoute = DocsRouteImport.update({
+ id: '/docs',
+ path: '/docs',
+ getParentRoute: () => rootRouteImport,
+} as any)
const SectionsSectionRoute = SectionsSectionRouteImport.update({
id: '/sections/$section',
path: '/sections/$section',
@@ -61,13 +61,6 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/docs': {
- id: '/docs'
- path: '/docs'
- fullPath: '/docs'
- preLoaderRoute: typeof DocsRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -75,6 +68,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
+ '/docs': {
+ id: '/docs'
+ path: '/docs'
+ fullPath: '/docs'
+ preLoaderRoute: typeof DocsRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/sections/$section': {
id: '/sections/$section'
path: '/sections/$section'
diff --git a/benchmarks/client-nav/scenarios/preload/solid/tsconfig.json b/benchmarks/client-nav/scenarios/preload/solid/tsconfig.json
index 8c57ff876a..98d76ad6b8 100644
--- a/benchmarks/client-nav/scenarios/preload/solid/tsconfig.json
+++ b/benchmarks/client-nav/scenarios/preload/solid/tsconfig.json
@@ -2,7 +2,7 @@
"extends": "../../../../../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"allowImportingTsExtensions": true,
"types": ["node", "vite/client", "vitest/globals"]
},
diff --git a/benchmarks/client-nav/scenarios/preload/solid/vite.config.ts b/benchmarks/client-nav/scenarios/preload/solid/vite.config.ts
index 99f5b9fad5..07014e6124 100644
--- a/benchmarks/client-nav/scenarios/preload/solid/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/preload/solid/vite.config.ts
@@ -1,8 +1,9 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -19,7 +20,7 @@ export default defineConfig({
routesDirectory: `${rootDir}src/routes`,
generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
}),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -35,6 +36,7 @@ export default defineConfig({
conditions: ['solid', 'browser'],
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav preload (solid)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts
index 38a2e9e664..e0ec83619b 100644
--- a/benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-preload', () => {
- const test = setup()
+test('client-preload', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-preload interaction loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/preload/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/preload/vue/src/routeTree.gen.ts
index 05a751060b..5f95d09da0 100644
--- a/benchmarks/client-nav/scenarios/preload/vue/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/preload/vue/src/routeTree.gen.ts
@@ -9,20 +9,20 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as DocsRouteImport } from './routes/docs'
import { Route as IndexRouteImport } from './routes/index'
+import { Route as DocsRouteImport } from './routes/docs'
import { Route as SectionsSectionRouteImport } from './routes/sections.$section'
-const DocsRoute = DocsRouteImport.update({
- id: '/docs',
- path: '/docs',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
+const DocsRoute = DocsRouteImport.update({
+ id: '/docs',
+ path: '/docs',
+ getParentRoute: () => rootRouteImport,
+} as any)
const SectionsSectionRoute = SectionsSectionRouteImport.update({
id: '/sections/$section',
path: '/sections/$section',
@@ -61,13 +61,6 @@ export interface RootRouteChildren {
declare module '@tanstack/vue-router' {
interface FileRoutesByPath {
- '/docs': {
- id: '/docs'
- path: '/docs'
- fullPath: '/docs'
- preLoaderRoute: typeof DocsRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -75,6 +68,13 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
+ '/docs': {
+ id: '/docs'
+ path: '/docs'
+ fullPath: '/docs'
+ preLoaderRoute: typeof DocsRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/sections/$section': {
id: '/sections/$section'
path: '/sections/$section'
diff --git a/benchmarks/client-nav/scenarios/preload/vue/vite.config.ts b/benchmarks/client-nav/scenarios/preload/vue/vite.config.ts
index 25e64b5bef..8d00e66378 100644
--- a/benchmarks/client-nav/scenarios/preload/vue/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/preload/vue/vite.config.ts
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -34,6 +35,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav preload (vue)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts b/benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts
index 8e79c6db7e..dd1b6f3686 100644
--- a/benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-rewrites', () => {
- const test = setup()
+test('client-rewrites', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-rewrites navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/rewrites/react/vite.config.ts b/benchmarks/client-nav/scenarios/rewrites/react/vite.config.ts
index 8c07cff4fb..e79e8522e9 100644
--- a/benchmarks/client-nav/scenarios/rewrites/react/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/rewrites/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -32,6 +33,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav rewrites (react)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts
index cf70bcaa40..9c4313e2ff 100644
--- a/benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-rewrites', () => {
- const test = setup()
+test('client-rewrites', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-rewrites navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx b/benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx
index 9f34e66a66..31f1d07650 100644
--- a/benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx
+++ b/benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx
@@ -1,5 +1,5 @@
import type { RouterHistory } from '@tanstack/history'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { RouterProvider, createRouter } from '@tanstack/solid-router'
import { routeTree } from './routeTree.gen'
import { basepath, localeRewrite } from '../../shared'
diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/tsconfig.json b/benchmarks/client-nav/scenarios/rewrites/solid/tsconfig.json
index 8c57ff876a..98d76ad6b8 100644
--- a/benchmarks/client-nav/scenarios/rewrites/solid/tsconfig.json
+++ b/benchmarks/client-nav/scenarios/rewrites/solid/tsconfig.json
@@ -2,7 +2,7 @@
"extends": "../../../../../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"allowImportingTsExtensions": true,
"types": ["node", "vite/client", "vitest/globals"]
},
diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/vite.config.ts b/benchmarks/client-nav/scenarios/rewrites/solid/vite.config.ts
index c499a0a89b..c9e99b7d60 100644
--- a/benchmarks/client-nav/scenarios/rewrites/solid/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/rewrites/solid/vite.config.ts
@@ -1,8 +1,9 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -19,7 +20,7 @@ export default defineConfig({
routesDirectory: `${rootDir}src/routes`,
generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
}),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -35,6 +36,7 @@ export default defineConfig({
conditions: ['solid', 'browser'],
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav rewrites (solid)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts
index 2dc9eb2679..e96aff39eb 100644
--- a/benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-rewrites', () => {
- const test = setup()
+test('client-rewrites', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-rewrites navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/vite.config.ts b/benchmarks/client-nav/scenarios/rewrites/vue/vite.config.ts
index 39e22b6c3e..1a795a4e1d 100644
--- a/benchmarks/client-nav/scenarios/rewrites/vue/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/rewrites/vue/vite.config.ts
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -34,6 +35,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav rewrites (vue)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts b/benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts
index 337ba35b73..6f4b448775 100644
--- a/benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-route-tree-scale', () => {
- const test = setup()
+test('client-route-tree-scale', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-route-tree-scale navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/vite.config.ts b/benchmarks/client-nav/scenarios/route-tree-scale/react/vite.config.ts
index 686907a506..0f588fda53 100644
--- a/benchmarks/client-nav/scenarios/route-tree-scale/react/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/route-tree-scale/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -35,6 +36,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav route-tree-scale (react)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts
index 545b501617..9244ef1350 100644
--- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-route-tree-scale', () => {
- const test = setup()
+test('client-route-tree-scale', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-route-tree-scale navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx
index f7148011f5..fa9d239418 100644
--- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx
+++ b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx
@@ -1,5 +1,5 @@
import type { RouterHistory } from '@tanstack/history'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { RouterProvider, createRouter } from '@tanstack/solid-router'
import { routeTree } from './routeTree.gen'
diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routeTree.gen.ts
index 20b4af6146..e6f3596562 100644
--- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routeTree.gen.ts
@@ -9,68 +9,52 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as SecFRouteImport } from './routes/sec-f'
-import { Route as SecERouteImport } from './routes/sec-e'
-import { Route as SecDRouteImport } from './routes/sec-d'
-import { Route as SecCRouteImport } from './routes/sec-c'
-import { Route as SecBRouteImport } from './routes/sec-b'
-import { Route as SecARouteImport } from './routes/sec-a'
-import { Route as LayoutRouteImport } from './routes/_layout'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as SecFIndexRouteImport } from './routes/sec-f.index'
-import { Route as SecEIndexRouteImport } from './routes/sec-e.index'
-import { Route as SecDIndexRouteImport } from './routes/sec-d.index'
-import { Route as SecCIndexRouteImport } from './routes/sec-c.index'
-import { Route as SecBIndexRouteImport } from './routes/sec-b.index'
-import { Route as SecAIndexRouteImport } from './routes/sec-a.index'
-import { Route as SecFSettingsRouteImport } from './routes/sec-f.settings'
-import { Route as SecFAboutRouteImport } from './routes/sec-f.about'
-import { Route as SecFIdRouteImport } from './routes/sec-f.$id'
-import { Route as SecESettingsRouteImport } from './routes/sec-e.settings'
-import { Route as SecEAboutRouteImport } from './routes/sec-e.about'
-import { Route as SecEIdRouteImport } from './routes/sec-e.$id'
-import { Route as SecDSettingsRouteImport } from './routes/sec-d.settings'
-import { Route as SecDAboutRouteImport } from './routes/sec-d.about'
-import { Route as SecDIdRouteImport } from './routes/sec-d.$id'
-import { Route as SecCSettingsRouteImport } from './routes/sec-c.settings'
-import { Route as SecCAboutRouteImport } from './routes/sec-c.about'
-import { Route as SecCIdRouteImport } from './routes/sec-c.$id'
-import { Route as SecBSettingsRouteImport } from './routes/sec-b.settings'
-import { Route as SecBAboutRouteImport } from './routes/sec-b.about'
-import { Route as SecBIdRouteImport } from './routes/sec-b.$id'
-import { Route as SecASettingsRouteImport } from './routes/sec-a.settings'
-import { Route as SecAAboutRouteImport } from './routes/sec-a.about'
-import { Route as SecAIdRouteImport } from './routes/sec-a.$id'
-import { Route as ReleaseVChar123versionChar125RouteImport } from './routes/release.v{$version}'
-import { Route as FilesSplatRouteImport } from './routes/files.$'
-import { Route as LayoutBetaRouteImport } from './routes/_layout.beta'
-import { Route as LayoutAlphaRouteImport } from './routes/_layout.alpha'
-import { Route as marketingPromoRouteImport } from './routes/(marketing)/promo'
+import { Route as LayoutRouteImport } from './routes/_layout'
+import { Route as SecARouteImport } from './routes/sec-a'
+import { Route as SecBRouteImport } from './routes/sec-b'
+import { Route as SecCRouteImport } from './routes/sec-c'
+import { Route as SecDRouteImport } from './routes/sec-d'
+import { Route as SecERouteImport } from './routes/sec-e'
+import { Route as SecFRouteImport } from './routes/sec-f'
import { Route as marketingPricingRouteImport } from './routes/(marketing)/pricing'
+import { Route as marketingPromoRouteImport } from './routes/(marketing)/promo'
+import { Route as LayoutAlphaRouteImport } from './routes/_layout.alpha'
+import { Route as LayoutBetaRouteImport } from './routes/_layout.beta'
+import { Route as FilesSplatRouteImport } from './routes/files.$'
+import { Route as ReleaseVChar123versionChar125RouteImport } from './routes/release.v{$version}'
+import { Route as SecAIndexRouteImport } from './routes/sec-a.index'
+import { Route as SecAIdRouteImport } from './routes/sec-a.$id'
+import { Route as SecAAboutRouteImport } from './routes/sec-a.about'
+import { Route as SecASettingsRouteImport } from './routes/sec-a.settings'
+import { Route as SecBIndexRouteImport } from './routes/sec-b.index'
+import { Route as SecBIdRouteImport } from './routes/sec-b.$id'
+import { Route as SecBAboutRouteImport } from './routes/sec-b.about'
+import { Route as SecBSettingsRouteImport } from './routes/sec-b.settings'
+import { Route as SecCIndexRouteImport } from './routes/sec-c.index'
+import { Route as SecCIdRouteImport } from './routes/sec-c.$id'
+import { Route as SecCAboutRouteImport } from './routes/sec-c.about'
+import { Route as SecCSettingsRouteImport } from './routes/sec-c.settings'
+import { Route as SecDIndexRouteImport } from './routes/sec-d.index'
+import { Route as SecDIdRouteImport } from './routes/sec-d.$id'
+import { Route as SecDAboutRouteImport } from './routes/sec-d.about'
+import { Route as SecDSettingsRouteImport } from './routes/sec-d.settings'
+import { Route as SecEIndexRouteImport } from './routes/sec-e.index'
+import { Route as SecEIdRouteImport } from './routes/sec-e.$id'
+import { Route as SecEAboutRouteImport } from './routes/sec-e.about'
+import { Route as SecESettingsRouteImport } from './routes/sec-e.settings'
+import { Route as SecFIndexRouteImport } from './routes/sec-f.index'
+import { Route as SecFIdRouteImport } from './routes/sec-f.$id'
+import { Route as SecFAboutRouteImport } from './routes/sec-f.about'
+import { Route as SecFSettingsRouteImport } from './routes/sec-f.settings'
-const SecFRoute = SecFRouteImport.update({
- id: '/sec-f',
- path: '/sec-f',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const SecERoute = SecERouteImport.update({
- id: '/sec-e',
- path: '/sec-e',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SecDRoute = SecDRouteImport.update({
- id: '/sec-d',
- path: '/sec-d',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SecCRoute = SecCRouteImport.update({
- id: '/sec-c',
- path: '/sec-c',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SecBRoute = SecBRouteImport.update({
- id: '/sec-b',
- path: '/sec-b',
+const LayoutRoute = LayoutRouteImport.update({
+ id: '/_layout',
getParentRoute: () => rootRouteImport,
} as any)
const SecARoute = SecARouteImport.update({
@@ -78,134 +62,55 @@ const SecARoute = SecARouteImport.update({
path: '/sec-a',
getParentRoute: () => rootRouteImport,
} as any)
-const LayoutRoute = LayoutRouteImport.update({
- id: '/_layout',
+const SecBRoute = SecBRouteImport.update({
+ id: '/sec-b',
+ path: '/sec-b',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const SecCRoute = SecCRouteImport.update({
+ id: '/sec-c',
+ path: '/sec-c',
getParentRoute: () => rootRouteImport,
} as any)
-const SecFIndexRoute = SecFIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecFRoute,
+const SecDRoute = SecDRouteImport.update({
+ id: '/sec-d',
+ path: '/sec-d',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecEIndexRoute = SecEIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecERoute,
+const SecERoute = SecERouteImport.update({
+ id: '/sec-e',
+ path: '/sec-e',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecDIndexRoute = SecDIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecDRoute,
+const SecFRoute = SecFRouteImport.update({
+ id: '/sec-f',
+ path: '/sec-f',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecCIndexRoute = SecCIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecCRoute,
+const marketingPricingRoute = marketingPricingRouteImport.update({
+ id: '/(marketing)/pricing',
+ path: '/pricing',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecBIndexRoute = SecBIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecBRoute,
+const marketingPromoRoute = marketingPromoRouteImport.update({
+ id: '/(marketing)/promo',
+ path: '/promo',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecAIndexRoute = SecAIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecARoute,
+const LayoutAlphaRoute = LayoutAlphaRouteImport.update({
+ id: '/alpha',
+ path: '/alpha',
+ getParentRoute: () => LayoutRoute,
} as any)
-const SecFSettingsRoute = SecFSettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecFRoute,
+const LayoutBetaRoute = LayoutBetaRouteImport.update({
+ id: '/beta',
+ path: '/beta',
+ getParentRoute: () => LayoutRoute,
} as any)
-const SecFAboutRoute = SecFAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecFRoute,
-} as any)
-const SecFIdRoute = SecFIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecFRoute,
-} as any)
-const SecESettingsRoute = SecESettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecERoute,
-} as any)
-const SecEAboutRoute = SecEAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecERoute,
-} as any)
-const SecEIdRoute = SecEIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecERoute,
-} as any)
-const SecDSettingsRoute = SecDSettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecDRoute,
-} as any)
-const SecDAboutRoute = SecDAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecDRoute,
-} as any)
-const SecDIdRoute = SecDIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecDRoute,
-} as any)
-const SecCSettingsRoute = SecCSettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecCRoute,
-} as any)
-const SecCAboutRoute = SecCAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecCRoute,
-} as any)
-const SecCIdRoute = SecCIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecCRoute,
-} as any)
-const SecBSettingsRoute = SecBSettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecBRoute,
-} as any)
-const SecBAboutRoute = SecBAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecBRoute,
-} as any)
-const SecBIdRoute = SecBIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecBRoute,
-} as any)
-const SecASettingsRoute = SecASettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecARoute,
-} as any)
-const SecAAboutRoute = SecAAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecARoute,
-} as any)
-const SecAIdRoute = SecAIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecARoute,
+const FilesSplatRoute = FilesSplatRouteImport.update({
+ id: '/files/$',
+ path: '/files/$',
+ getParentRoute: () => rootRouteImport,
} as any)
const ReleaseVChar123versionChar125Route =
ReleaseVChar123versionChar125RouteImport.update({
@@ -213,30 +118,125 @@ const ReleaseVChar123versionChar125Route =
path: '/release/v{$version}',
getParentRoute: () => rootRouteImport,
} as any)
-const FilesSplatRoute = FilesSplatRouteImport.update({
- id: '/files/$',
- path: '/files/$',
- getParentRoute: () => rootRouteImport,
+const SecAIndexRoute = SecAIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecARoute,
} as any)
-const LayoutBetaRoute = LayoutBetaRouteImport.update({
- id: '/beta',
- path: '/beta',
- getParentRoute: () => LayoutRoute,
+const SecAIdRoute = SecAIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecARoute,
} as any)
-const LayoutAlphaRoute = LayoutAlphaRouteImport.update({
- id: '/alpha',
- path: '/alpha',
- getParentRoute: () => LayoutRoute,
+const SecAAboutRoute = SecAAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecARoute,
} as any)
-const marketingPromoRoute = marketingPromoRouteImport.update({
- id: '/(marketing)/promo',
- path: '/promo',
- getParentRoute: () => rootRouteImport,
+const SecASettingsRoute = SecASettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecARoute,
} as any)
-const marketingPricingRoute = marketingPricingRouteImport.update({
- id: '/(marketing)/pricing',
- path: '/pricing',
- getParentRoute: () => rootRouteImport,
+const SecBIndexRoute = SecBIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecBRoute,
+} as any)
+const SecBIdRoute = SecBIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecBRoute,
+} as any)
+const SecBAboutRoute = SecBAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecBRoute,
+} as any)
+const SecBSettingsRoute = SecBSettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecBRoute,
+} as any)
+const SecCIndexRoute = SecCIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecCRoute,
+} as any)
+const SecCIdRoute = SecCIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecCRoute,
+} as any)
+const SecCAboutRoute = SecCAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecCRoute,
+} as any)
+const SecCSettingsRoute = SecCSettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecCRoute,
+} as any)
+const SecDIndexRoute = SecDIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecDRoute,
+} as any)
+const SecDIdRoute = SecDIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecDRoute,
+} as any)
+const SecDAboutRoute = SecDAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecDRoute,
+} as any)
+const SecDSettingsRoute = SecDSettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecDRoute,
+} as any)
+const SecEIndexRoute = SecEIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecERoute,
+} as any)
+const SecEIdRoute = SecEIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecERoute,
+} as any)
+const SecEAboutRoute = SecEAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecERoute,
+} as any)
+const SecESettingsRoute = SecESettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecERoute,
+} as any)
+const SecFIndexRoute = SecFIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecFRoute,
+} as any)
+const SecFIdRoute = SecFIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecFRoute,
+} as any)
+const SecFAboutRoute = SecFAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecFRoute,
+} as any)
+const SecFSettingsRoute = SecFSettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecFRoute,
} as any)
export interface FileRoutesByFullPath {
@@ -484,46 +484,11 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/sec-f': {
- id: '/sec-f'
- path: '/sec-f'
- fullPath: '/sec-f'
- preLoaderRoute: typeof SecFRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-e': {
- id: '/sec-e'
- path: '/sec-e'
- fullPath: '/sec-e'
- preLoaderRoute: typeof SecERouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-d': {
- id: '/sec-d'
- path: '/sec-d'
- fullPath: '/sec-d'
- preLoaderRoute: typeof SecDRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-c': {
- id: '/sec-c'
- path: '/sec-c'
- fullPath: '/sec-c'
- preLoaderRoute: typeof SecCRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-b': {
- id: '/sec-b'
- path: '/sec-b'
- fullPath: '/sec-b'
- preLoaderRoute: typeof SecBRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-a': {
- id: '/sec-a'
- path: '/sec-a'
- fullPath: '/sec-a'
- preLoaderRoute: typeof SecARouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/_layout': {
@@ -533,47 +498,89 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof LayoutRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/sec-a': {
+ id: '/sec-a'
+ path: '/sec-a'
+ fullPath: '/sec-a'
+ preLoaderRoute: typeof SecARouteImport
parentRoute: typeof rootRouteImport
}
- '/sec-f/': {
- id: '/sec-f/'
- path: '/'
- fullPath: '/sec-f/'
- preLoaderRoute: typeof SecFIndexRouteImport
- parentRoute: typeof SecFRoute
+ '/sec-b': {
+ id: '/sec-b'
+ path: '/sec-b'
+ fullPath: '/sec-b'
+ preLoaderRoute: typeof SecBRouteImport
+ parentRoute: typeof rootRouteImport
}
- '/sec-e/': {
- id: '/sec-e/'
- path: '/'
- fullPath: '/sec-e/'
- preLoaderRoute: typeof SecEIndexRouteImport
- parentRoute: typeof SecERoute
+ '/sec-c': {
+ id: '/sec-c'
+ path: '/sec-c'
+ fullPath: '/sec-c'
+ preLoaderRoute: typeof SecCRouteImport
+ parentRoute: typeof rootRouteImport
}
- '/sec-d/': {
- id: '/sec-d/'
- path: '/'
- fullPath: '/sec-d/'
- preLoaderRoute: typeof SecDIndexRouteImport
- parentRoute: typeof SecDRoute
+ '/sec-d': {
+ id: '/sec-d'
+ path: '/sec-d'
+ fullPath: '/sec-d'
+ preLoaderRoute: typeof SecDRouteImport
+ parentRoute: typeof rootRouteImport
}
- '/sec-c/': {
- id: '/sec-c/'
- path: '/'
- fullPath: '/sec-c/'
- preLoaderRoute: typeof SecCIndexRouteImport
- parentRoute: typeof SecCRoute
+ '/sec-e': {
+ id: '/sec-e'
+ path: '/sec-e'
+ fullPath: '/sec-e'
+ preLoaderRoute: typeof SecERouteImport
+ parentRoute: typeof rootRouteImport
}
- '/sec-b/': {
- id: '/sec-b/'
- path: '/'
- fullPath: '/sec-b/'
- preLoaderRoute: typeof SecBIndexRouteImport
- parentRoute: typeof SecBRoute
+ '/sec-f': {
+ id: '/sec-f'
+ path: '/sec-f'
+ fullPath: '/sec-f'
+ preLoaderRoute: typeof SecFRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/(marketing)/pricing': {
+ id: '/(marketing)/pricing'
+ path: '/pricing'
+ fullPath: '/pricing'
+ preLoaderRoute: typeof marketingPricingRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/(marketing)/promo': {
+ id: '/(marketing)/promo'
+ path: '/promo'
+ fullPath: '/promo'
+ preLoaderRoute: typeof marketingPromoRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/_layout/alpha': {
+ id: '/_layout/alpha'
+ path: '/alpha'
+ fullPath: '/alpha'
+ preLoaderRoute: typeof LayoutAlphaRouteImport
+ parentRoute: typeof LayoutRoute
+ }
+ '/_layout/beta': {
+ id: '/_layout/beta'
+ path: '/beta'
+ fullPath: '/beta'
+ preLoaderRoute: typeof LayoutBetaRouteImport
+ parentRoute: typeof LayoutRoute
+ }
+ '/files/$': {
+ id: '/files/$'
+ path: '/files/$'
+ fullPath: '/files/$'
+ preLoaderRoute: typeof FilesSplatRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/release/v{$version}': {
+ id: '/release/v{$version}'
+ path: '/release/v{$version}'
+ fullPath: '/release/v{$version}'
+ preLoaderRoute: typeof ReleaseVChar123versionChar125RouteImport
+ parentRoute: typeof rootRouteImport
}
'/sec-a/': {
id: '/sec-a/'
@@ -582,125 +589,6 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof SecAIndexRouteImport
parentRoute: typeof SecARoute
}
- '/sec-f/settings': {
- id: '/sec-f/settings'
- path: '/settings'
- fullPath: '/sec-f/settings'
- preLoaderRoute: typeof SecFSettingsRouteImport
- parentRoute: typeof SecFRoute
- }
- '/sec-f/about': {
- id: '/sec-f/about'
- path: '/about'
- fullPath: '/sec-f/about'
- preLoaderRoute: typeof SecFAboutRouteImport
- parentRoute: typeof SecFRoute
- }
- '/sec-f/$id': {
- id: '/sec-f/$id'
- path: '/$id'
- fullPath: '/sec-f/$id'
- preLoaderRoute: typeof SecFIdRouteImport
- parentRoute: typeof SecFRoute
- }
- '/sec-e/settings': {
- id: '/sec-e/settings'
- path: '/settings'
- fullPath: '/sec-e/settings'
- preLoaderRoute: typeof SecESettingsRouteImport
- parentRoute: typeof SecERoute
- }
- '/sec-e/about': {
- id: '/sec-e/about'
- path: '/about'
- fullPath: '/sec-e/about'
- preLoaderRoute: typeof SecEAboutRouteImport
- parentRoute: typeof SecERoute
- }
- '/sec-e/$id': {
- id: '/sec-e/$id'
- path: '/$id'
- fullPath: '/sec-e/$id'
- preLoaderRoute: typeof SecEIdRouteImport
- parentRoute: typeof SecERoute
- }
- '/sec-d/settings': {
- id: '/sec-d/settings'
- path: '/settings'
- fullPath: '/sec-d/settings'
- preLoaderRoute: typeof SecDSettingsRouteImport
- parentRoute: typeof SecDRoute
- }
- '/sec-d/about': {
- id: '/sec-d/about'
- path: '/about'
- fullPath: '/sec-d/about'
- preLoaderRoute: typeof SecDAboutRouteImport
- parentRoute: typeof SecDRoute
- }
- '/sec-d/$id': {
- id: '/sec-d/$id'
- path: '/$id'
- fullPath: '/sec-d/$id'
- preLoaderRoute: typeof SecDIdRouteImport
- parentRoute: typeof SecDRoute
- }
- '/sec-c/settings': {
- id: '/sec-c/settings'
- path: '/settings'
- fullPath: '/sec-c/settings'
- preLoaderRoute: typeof SecCSettingsRouteImport
- parentRoute: typeof SecCRoute
- }
- '/sec-c/about': {
- id: '/sec-c/about'
- path: '/about'
- fullPath: '/sec-c/about'
- preLoaderRoute: typeof SecCAboutRouteImport
- parentRoute: typeof SecCRoute
- }
- '/sec-c/$id': {
- id: '/sec-c/$id'
- path: '/$id'
- fullPath: '/sec-c/$id'
- preLoaderRoute: typeof SecCIdRouteImport
- parentRoute: typeof SecCRoute
- }
- '/sec-b/settings': {
- id: '/sec-b/settings'
- path: '/settings'
- fullPath: '/sec-b/settings'
- preLoaderRoute: typeof SecBSettingsRouteImport
- parentRoute: typeof SecBRoute
- }
- '/sec-b/about': {
- id: '/sec-b/about'
- path: '/about'
- fullPath: '/sec-b/about'
- preLoaderRoute: typeof SecBAboutRouteImport
- parentRoute: typeof SecBRoute
- }
- '/sec-b/$id': {
- id: '/sec-b/$id'
- path: '/$id'
- fullPath: '/sec-b/$id'
- preLoaderRoute: typeof SecBIdRouteImport
- parentRoute: typeof SecBRoute
- }
- '/sec-a/settings': {
- id: '/sec-a/settings'
- path: '/settings'
- fullPath: '/sec-a/settings'
- preLoaderRoute: typeof SecASettingsRouteImport
- parentRoute: typeof SecARoute
- }
- '/sec-a/about': {
- id: '/sec-a/about'
- path: '/about'
- fullPath: '/sec-a/about'
- preLoaderRoute: typeof SecAAboutRouteImport
- parentRoute: typeof SecARoute
- }
'/sec-a/$id': {
id: '/sec-a/$id'
path: '/$id'
@@ -708,47 +596,159 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof SecAIdRouteImport
parentRoute: typeof SecARoute
}
- '/release/v{$version}': {
- id: '/release/v{$version}'
- path: '/release/v{$version}'
- fullPath: '/release/v{$version}'
- preLoaderRoute: typeof ReleaseVChar123versionChar125RouteImport
- parentRoute: typeof rootRouteImport
+ '/sec-a/about': {
+ id: '/sec-a/about'
+ path: '/about'
+ fullPath: '/sec-a/about'
+ preLoaderRoute: typeof SecAAboutRouteImport
+ parentRoute: typeof SecARoute
}
- '/files/$': {
- id: '/files/$'
- path: '/files/$'
- fullPath: '/files/$'
- preLoaderRoute: typeof FilesSplatRouteImport
- parentRoute: typeof rootRouteImport
+ '/sec-a/settings': {
+ id: '/sec-a/settings'
+ path: '/settings'
+ fullPath: '/sec-a/settings'
+ preLoaderRoute: typeof SecASettingsRouteImport
+ parentRoute: typeof SecARoute
}
- '/_layout/beta': {
- id: '/_layout/beta'
- path: '/beta'
- fullPath: '/beta'
- preLoaderRoute: typeof LayoutBetaRouteImport
- parentRoute: typeof LayoutRoute
+ '/sec-b/': {
+ id: '/sec-b/'
+ path: '/'
+ fullPath: '/sec-b/'
+ preLoaderRoute: typeof SecBIndexRouteImport
+ parentRoute: typeof SecBRoute
}
- '/_layout/alpha': {
- id: '/_layout/alpha'
- path: '/alpha'
- fullPath: '/alpha'
- preLoaderRoute: typeof LayoutAlphaRouteImport
- parentRoute: typeof LayoutRoute
+ '/sec-b/$id': {
+ id: '/sec-b/$id'
+ path: '/$id'
+ fullPath: '/sec-b/$id'
+ preLoaderRoute: typeof SecBIdRouteImport
+ parentRoute: typeof SecBRoute
}
- '/(marketing)/promo': {
- id: '/(marketing)/promo'
- path: '/promo'
- fullPath: '/promo'
- preLoaderRoute: typeof marketingPromoRouteImport
- parentRoute: typeof rootRouteImport
+ '/sec-b/about': {
+ id: '/sec-b/about'
+ path: '/about'
+ fullPath: '/sec-b/about'
+ preLoaderRoute: typeof SecBAboutRouteImport
+ parentRoute: typeof SecBRoute
}
- '/(marketing)/pricing': {
- id: '/(marketing)/pricing'
- path: '/pricing'
- fullPath: '/pricing'
- preLoaderRoute: typeof marketingPricingRouteImport
- parentRoute: typeof rootRouteImport
+ '/sec-b/settings': {
+ id: '/sec-b/settings'
+ path: '/settings'
+ fullPath: '/sec-b/settings'
+ preLoaderRoute: typeof SecBSettingsRouteImport
+ parentRoute: typeof SecBRoute
+ }
+ '/sec-c/': {
+ id: '/sec-c/'
+ path: '/'
+ fullPath: '/sec-c/'
+ preLoaderRoute: typeof SecCIndexRouteImport
+ parentRoute: typeof SecCRoute
+ }
+ '/sec-c/$id': {
+ id: '/sec-c/$id'
+ path: '/$id'
+ fullPath: '/sec-c/$id'
+ preLoaderRoute: typeof SecCIdRouteImport
+ parentRoute: typeof SecCRoute
+ }
+ '/sec-c/about': {
+ id: '/sec-c/about'
+ path: '/about'
+ fullPath: '/sec-c/about'
+ preLoaderRoute: typeof SecCAboutRouteImport
+ parentRoute: typeof SecCRoute
+ }
+ '/sec-c/settings': {
+ id: '/sec-c/settings'
+ path: '/settings'
+ fullPath: '/sec-c/settings'
+ preLoaderRoute: typeof SecCSettingsRouteImport
+ parentRoute: typeof SecCRoute
+ }
+ '/sec-d/': {
+ id: '/sec-d/'
+ path: '/'
+ fullPath: '/sec-d/'
+ preLoaderRoute: typeof SecDIndexRouteImport
+ parentRoute: typeof SecDRoute
+ }
+ '/sec-d/$id': {
+ id: '/sec-d/$id'
+ path: '/$id'
+ fullPath: '/sec-d/$id'
+ preLoaderRoute: typeof SecDIdRouteImport
+ parentRoute: typeof SecDRoute
+ }
+ '/sec-d/about': {
+ id: '/sec-d/about'
+ path: '/about'
+ fullPath: '/sec-d/about'
+ preLoaderRoute: typeof SecDAboutRouteImport
+ parentRoute: typeof SecDRoute
+ }
+ '/sec-d/settings': {
+ id: '/sec-d/settings'
+ path: '/settings'
+ fullPath: '/sec-d/settings'
+ preLoaderRoute: typeof SecDSettingsRouteImport
+ parentRoute: typeof SecDRoute
+ }
+ '/sec-e/': {
+ id: '/sec-e/'
+ path: '/'
+ fullPath: '/sec-e/'
+ preLoaderRoute: typeof SecEIndexRouteImport
+ parentRoute: typeof SecERoute
+ }
+ '/sec-e/$id': {
+ id: '/sec-e/$id'
+ path: '/$id'
+ fullPath: '/sec-e/$id'
+ preLoaderRoute: typeof SecEIdRouteImport
+ parentRoute: typeof SecERoute
+ }
+ '/sec-e/about': {
+ id: '/sec-e/about'
+ path: '/about'
+ fullPath: '/sec-e/about'
+ preLoaderRoute: typeof SecEAboutRouteImport
+ parentRoute: typeof SecERoute
+ }
+ '/sec-e/settings': {
+ id: '/sec-e/settings'
+ path: '/settings'
+ fullPath: '/sec-e/settings'
+ preLoaderRoute: typeof SecESettingsRouteImport
+ parentRoute: typeof SecERoute
+ }
+ '/sec-f/': {
+ id: '/sec-f/'
+ path: '/'
+ fullPath: '/sec-f/'
+ preLoaderRoute: typeof SecFIndexRouteImport
+ parentRoute: typeof SecFRoute
+ }
+ '/sec-f/$id': {
+ id: '/sec-f/$id'
+ path: '/$id'
+ fullPath: '/sec-f/$id'
+ preLoaderRoute: typeof SecFIdRouteImport
+ parentRoute: typeof SecFRoute
+ }
+ '/sec-f/about': {
+ id: '/sec-f/about'
+ path: '/about'
+ fullPath: '/sec-f/about'
+ preLoaderRoute: typeof SecFAboutRouteImport
+ parentRoute: typeof SecFRoute
+ }
+ '/sec-f/settings': {
+ id: '/sec-f/settings'
+ path: '/settings'
+ fullPath: '/sec-f/settings'
+ preLoaderRoute: typeof SecFSettingsRouteImport
+ parentRoute: typeof SecFRoute
}
}
}
diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/tsconfig.json b/benchmarks/client-nav/scenarios/route-tree-scale/solid/tsconfig.json
index 8c57ff876a..98d76ad6b8 100644
--- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/tsconfig.json
+++ b/benchmarks/client-nav/scenarios/route-tree-scale/solid/tsconfig.json
@@ -2,7 +2,7 @@
"extends": "../../../../../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"allowImportingTsExtensions": true,
"types": ["node", "vite/client", "vitest/globals"]
},
diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/vite.config.ts b/benchmarks/client-nav/scenarios/route-tree-scale/solid/vite.config.ts
index 3c870e9c21..542ede131b 100644
--- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/route-tree-scale/solid/vite.config.ts
@@ -1,8 +1,9 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -22,7 +23,7 @@ export default defineConfig({
routesDirectory: `${rootDir}src/routes`,
generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
}),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -38,6 +39,7 @@ export default defineConfig({
conditions: ['solid', 'browser'],
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav route-tree-scale (solid)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts
index 9365231579..331e8e008f 100644
--- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-route-tree-scale', () => {
- const test = setup()
+test('client-route-tree-scale', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-route-tree-scale navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routeTree.gen.ts
index a03c051a79..a12f981bb4 100644
--- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routeTree.gen.ts
@@ -9,68 +9,52 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as SecFRouteImport } from './routes/sec-f'
-import { Route as SecERouteImport } from './routes/sec-e'
-import { Route as SecDRouteImport } from './routes/sec-d'
-import { Route as SecCRouteImport } from './routes/sec-c'
-import { Route as SecBRouteImport } from './routes/sec-b'
-import { Route as SecARouteImport } from './routes/sec-a'
-import { Route as LayoutRouteImport } from './routes/_layout'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as SecFIndexRouteImport } from './routes/sec-f.index'
-import { Route as SecEIndexRouteImport } from './routes/sec-e.index'
-import { Route as SecDIndexRouteImport } from './routes/sec-d.index'
-import { Route as SecCIndexRouteImport } from './routes/sec-c.index'
-import { Route as SecBIndexRouteImport } from './routes/sec-b.index'
-import { Route as SecAIndexRouteImport } from './routes/sec-a.index'
-import { Route as SecFSettingsRouteImport } from './routes/sec-f.settings'
-import { Route as SecFAboutRouteImport } from './routes/sec-f.about'
-import { Route as SecFIdRouteImport } from './routes/sec-f.$id'
-import { Route as SecESettingsRouteImport } from './routes/sec-e.settings'
-import { Route as SecEAboutRouteImport } from './routes/sec-e.about'
-import { Route as SecEIdRouteImport } from './routes/sec-e.$id'
-import { Route as SecDSettingsRouteImport } from './routes/sec-d.settings'
-import { Route as SecDAboutRouteImport } from './routes/sec-d.about'
-import { Route as SecDIdRouteImport } from './routes/sec-d.$id'
-import { Route as SecCSettingsRouteImport } from './routes/sec-c.settings'
-import { Route as SecCAboutRouteImport } from './routes/sec-c.about'
-import { Route as SecCIdRouteImport } from './routes/sec-c.$id'
-import { Route as SecBSettingsRouteImport } from './routes/sec-b.settings'
-import { Route as SecBAboutRouteImport } from './routes/sec-b.about'
-import { Route as SecBIdRouteImport } from './routes/sec-b.$id'
-import { Route as SecASettingsRouteImport } from './routes/sec-a.settings'
-import { Route as SecAAboutRouteImport } from './routes/sec-a.about'
-import { Route as SecAIdRouteImport } from './routes/sec-a.$id'
-import { Route as ReleaseVChar123versionChar125RouteImport } from './routes/release.v{$version}'
-import { Route as FilesSplatRouteImport } from './routes/files.$'
-import { Route as LayoutBetaRouteImport } from './routes/_layout.beta'
-import { Route as LayoutAlphaRouteImport } from './routes/_layout.alpha'
-import { Route as marketingPromoRouteImport } from './routes/(marketing)/promo'
+import { Route as LayoutRouteImport } from './routes/_layout'
+import { Route as SecARouteImport } from './routes/sec-a'
+import { Route as SecBRouteImport } from './routes/sec-b'
+import { Route as SecCRouteImport } from './routes/sec-c'
+import { Route as SecDRouteImport } from './routes/sec-d'
+import { Route as SecERouteImport } from './routes/sec-e'
+import { Route as SecFRouteImport } from './routes/sec-f'
import { Route as marketingPricingRouteImport } from './routes/(marketing)/pricing'
+import { Route as marketingPromoRouteImport } from './routes/(marketing)/promo'
+import { Route as LayoutAlphaRouteImport } from './routes/_layout.alpha'
+import { Route as LayoutBetaRouteImport } from './routes/_layout.beta'
+import { Route as FilesSplatRouteImport } from './routes/files.$'
+import { Route as ReleaseVChar123versionChar125RouteImport } from './routes/release.v{$version}'
+import { Route as SecAIndexRouteImport } from './routes/sec-a.index'
+import { Route as SecAIdRouteImport } from './routes/sec-a.$id'
+import { Route as SecAAboutRouteImport } from './routes/sec-a.about'
+import { Route as SecASettingsRouteImport } from './routes/sec-a.settings'
+import { Route as SecBIndexRouteImport } from './routes/sec-b.index'
+import { Route as SecBIdRouteImport } from './routes/sec-b.$id'
+import { Route as SecBAboutRouteImport } from './routes/sec-b.about'
+import { Route as SecBSettingsRouteImport } from './routes/sec-b.settings'
+import { Route as SecCIndexRouteImport } from './routes/sec-c.index'
+import { Route as SecCIdRouteImport } from './routes/sec-c.$id'
+import { Route as SecCAboutRouteImport } from './routes/sec-c.about'
+import { Route as SecCSettingsRouteImport } from './routes/sec-c.settings'
+import { Route as SecDIndexRouteImport } from './routes/sec-d.index'
+import { Route as SecDIdRouteImport } from './routes/sec-d.$id'
+import { Route as SecDAboutRouteImport } from './routes/sec-d.about'
+import { Route as SecDSettingsRouteImport } from './routes/sec-d.settings'
+import { Route as SecEIndexRouteImport } from './routes/sec-e.index'
+import { Route as SecEIdRouteImport } from './routes/sec-e.$id'
+import { Route as SecEAboutRouteImport } from './routes/sec-e.about'
+import { Route as SecESettingsRouteImport } from './routes/sec-e.settings'
+import { Route as SecFIndexRouteImport } from './routes/sec-f.index'
+import { Route as SecFIdRouteImport } from './routes/sec-f.$id'
+import { Route as SecFAboutRouteImport } from './routes/sec-f.about'
+import { Route as SecFSettingsRouteImport } from './routes/sec-f.settings'
-const SecFRoute = SecFRouteImport.update({
- id: '/sec-f',
- path: '/sec-f',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const SecERoute = SecERouteImport.update({
- id: '/sec-e',
- path: '/sec-e',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SecDRoute = SecDRouteImport.update({
- id: '/sec-d',
- path: '/sec-d',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SecCRoute = SecCRouteImport.update({
- id: '/sec-c',
- path: '/sec-c',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SecBRoute = SecBRouteImport.update({
- id: '/sec-b',
- path: '/sec-b',
+const LayoutRoute = LayoutRouteImport.update({
+ id: '/_layout',
getParentRoute: () => rootRouteImport,
} as any)
const SecARoute = SecARouteImport.update({
@@ -78,134 +62,55 @@ const SecARoute = SecARouteImport.update({
path: '/sec-a',
getParentRoute: () => rootRouteImport,
} as any)
-const LayoutRoute = LayoutRouteImport.update({
- id: '/_layout',
+const SecBRoute = SecBRouteImport.update({
+ id: '/sec-b',
+ path: '/sec-b',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const SecCRoute = SecCRouteImport.update({
+ id: '/sec-c',
+ path: '/sec-c',
getParentRoute: () => rootRouteImport,
} as any)
-const SecFIndexRoute = SecFIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecFRoute,
+const SecDRoute = SecDRouteImport.update({
+ id: '/sec-d',
+ path: '/sec-d',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecEIndexRoute = SecEIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecERoute,
+const SecERoute = SecERouteImport.update({
+ id: '/sec-e',
+ path: '/sec-e',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecDIndexRoute = SecDIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecDRoute,
+const SecFRoute = SecFRouteImport.update({
+ id: '/sec-f',
+ path: '/sec-f',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecCIndexRoute = SecCIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecCRoute,
+const marketingPricingRoute = marketingPricingRouteImport.update({
+ id: '/(marketing)/pricing',
+ path: '/pricing',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecBIndexRoute = SecBIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecBRoute,
+const marketingPromoRoute = marketingPromoRouteImport.update({
+ id: '/(marketing)/promo',
+ path: '/promo',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecAIndexRoute = SecAIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecARoute,
+const LayoutAlphaRoute = LayoutAlphaRouteImport.update({
+ id: '/alpha',
+ path: '/alpha',
+ getParentRoute: () => LayoutRoute,
} as any)
-const SecFSettingsRoute = SecFSettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecFRoute,
+const LayoutBetaRoute = LayoutBetaRouteImport.update({
+ id: '/beta',
+ path: '/beta',
+ getParentRoute: () => LayoutRoute,
} as any)
-const SecFAboutRoute = SecFAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecFRoute,
-} as any)
-const SecFIdRoute = SecFIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecFRoute,
-} as any)
-const SecESettingsRoute = SecESettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecERoute,
-} as any)
-const SecEAboutRoute = SecEAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecERoute,
-} as any)
-const SecEIdRoute = SecEIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecERoute,
-} as any)
-const SecDSettingsRoute = SecDSettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecDRoute,
-} as any)
-const SecDAboutRoute = SecDAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecDRoute,
-} as any)
-const SecDIdRoute = SecDIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecDRoute,
-} as any)
-const SecCSettingsRoute = SecCSettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecCRoute,
-} as any)
-const SecCAboutRoute = SecCAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecCRoute,
-} as any)
-const SecCIdRoute = SecCIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecCRoute,
-} as any)
-const SecBSettingsRoute = SecBSettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecBRoute,
-} as any)
-const SecBAboutRoute = SecBAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecBRoute,
-} as any)
-const SecBIdRoute = SecBIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecBRoute,
-} as any)
-const SecASettingsRoute = SecASettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecARoute,
-} as any)
-const SecAAboutRoute = SecAAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecARoute,
-} as any)
-const SecAIdRoute = SecAIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecARoute,
+const FilesSplatRoute = FilesSplatRouteImport.update({
+ id: '/files/$',
+ path: '/files/$',
+ getParentRoute: () => rootRouteImport,
} as any)
const ReleaseVChar123versionChar125Route =
ReleaseVChar123versionChar125RouteImport.update({
@@ -213,30 +118,125 @@ const ReleaseVChar123versionChar125Route =
path: '/release/v{$version}',
getParentRoute: () => rootRouteImport,
} as any)
-const FilesSplatRoute = FilesSplatRouteImport.update({
- id: '/files/$',
- path: '/files/$',
- getParentRoute: () => rootRouteImport,
+const SecAIndexRoute = SecAIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecARoute,
} as any)
-const LayoutBetaRoute = LayoutBetaRouteImport.update({
- id: '/beta',
- path: '/beta',
- getParentRoute: () => LayoutRoute,
+const SecAIdRoute = SecAIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecARoute,
} as any)
-const LayoutAlphaRoute = LayoutAlphaRouteImport.update({
- id: '/alpha',
- path: '/alpha',
- getParentRoute: () => LayoutRoute,
+const SecAAboutRoute = SecAAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecARoute,
} as any)
-const marketingPromoRoute = marketingPromoRouteImport.update({
- id: '/(marketing)/promo',
- path: '/promo',
- getParentRoute: () => rootRouteImport,
+const SecASettingsRoute = SecASettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecARoute,
} as any)
-const marketingPricingRoute = marketingPricingRouteImport.update({
- id: '/(marketing)/pricing',
- path: '/pricing',
- getParentRoute: () => rootRouteImport,
+const SecBIndexRoute = SecBIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecBRoute,
+} as any)
+const SecBIdRoute = SecBIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecBRoute,
+} as any)
+const SecBAboutRoute = SecBAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecBRoute,
+} as any)
+const SecBSettingsRoute = SecBSettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecBRoute,
+} as any)
+const SecCIndexRoute = SecCIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecCRoute,
+} as any)
+const SecCIdRoute = SecCIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecCRoute,
+} as any)
+const SecCAboutRoute = SecCAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecCRoute,
+} as any)
+const SecCSettingsRoute = SecCSettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecCRoute,
+} as any)
+const SecDIndexRoute = SecDIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecDRoute,
+} as any)
+const SecDIdRoute = SecDIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecDRoute,
+} as any)
+const SecDAboutRoute = SecDAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecDRoute,
+} as any)
+const SecDSettingsRoute = SecDSettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecDRoute,
+} as any)
+const SecEIndexRoute = SecEIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecERoute,
+} as any)
+const SecEIdRoute = SecEIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecERoute,
+} as any)
+const SecEAboutRoute = SecEAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecERoute,
+} as any)
+const SecESettingsRoute = SecESettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecERoute,
+} as any)
+const SecFIndexRoute = SecFIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecFRoute,
+} as any)
+const SecFIdRoute = SecFIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecFRoute,
+} as any)
+const SecFAboutRoute = SecFAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecFRoute,
+} as any)
+const SecFSettingsRoute = SecFSettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecFRoute,
} as any)
export interface FileRoutesByFullPath {
@@ -484,46 +484,11 @@ export interface RootRouteChildren {
declare module '@tanstack/vue-router' {
interface FileRoutesByPath {
- '/sec-f': {
- id: '/sec-f'
- path: '/sec-f'
- fullPath: '/sec-f'
- preLoaderRoute: typeof SecFRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-e': {
- id: '/sec-e'
- path: '/sec-e'
- fullPath: '/sec-e'
- preLoaderRoute: typeof SecERouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-d': {
- id: '/sec-d'
- path: '/sec-d'
- fullPath: '/sec-d'
- preLoaderRoute: typeof SecDRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-c': {
- id: '/sec-c'
- path: '/sec-c'
- fullPath: '/sec-c'
- preLoaderRoute: typeof SecCRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-b': {
- id: '/sec-b'
- path: '/sec-b'
- fullPath: '/sec-b'
- preLoaderRoute: typeof SecBRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-a': {
- id: '/sec-a'
- path: '/sec-a'
- fullPath: '/sec-a'
- preLoaderRoute: typeof SecARouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/_layout': {
@@ -533,47 +498,89 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof LayoutRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/sec-a': {
+ id: '/sec-a'
+ path: '/sec-a'
+ fullPath: '/sec-a'
+ preLoaderRoute: typeof SecARouteImport
parentRoute: typeof rootRouteImport
}
- '/sec-f/': {
- id: '/sec-f/'
- path: '/'
- fullPath: '/sec-f/'
- preLoaderRoute: typeof SecFIndexRouteImport
- parentRoute: typeof SecFRoute
+ '/sec-b': {
+ id: '/sec-b'
+ path: '/sec-b'
+ fullPath: '/sec-b'
+ preLoaderRoute: typeof SecBRouteImport
+ parentRoute: typeof rootRouteImport
}
- '/sec-e/': {
- id: '/sec-e/'
- path: '/'
- fullPath: '/sec-e/'
- preLoaderRoute: typeof SecEIndexRouteImport
- parentRoute: typeof SecERoute
+ '/sec-c': {
+ id: '/sec-c'
+ path: '/sec-c'
+ fullPath: '/sec-c'
+ preLoaderRoute: typeof SecCRouteImport
+ parentRoute: typeof rootRouteImport
}
- '/sec-d/': {
- id: '/sec-d/'
- path: '/'
- fullPath: '/sec-d/'
- preLoaderRoute: typeof SecDIndexRouteImport
- parentRoute: typeof SecDRoute
+ '/sec-d': {
+ id: '/sec-d'
+ path: '/sec-d'
+ fullPath: '/sec-d'
+ preLoaderRoute: typeof SecDRouteImport
+ parentRoute: typeof rootRouteImport
}
- '/sec-c/': {
- id: '/sec-c/'
- path: '/'
- fullPath: '/sec-c/'
- preLoaderRoute: typeof SecCIndexRouteImport
- parentRoute: typeof SecCRoute
+ '/sec-e': {
+ id: '/sec-e'
+ path: '/sec-e'
+ fullPath: '/sec-e'
+ preLoaderRoute: typeof SecERouteImport
+ parentRoute: typeof rootRouteImport
}
- '/sec-b/': {
- id: '/sec-b/'
- path: '/'
- fullPath: '/sec-b/'
- preLoaderRoute: typeof SecBIndexRouteImport
- parentRoute: typeof SecBRoute
+ '/sec-f': {
+ id: '/sec-f'
+ path: '/sec-f'
+ fullPath: '/sec-f'
+ preLoaderRoute: typeof SecFRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/(marketing)/pricing': {
+ id: '/(marketing)/pricing'
+ path: '/pricing'
+ fullPath: '/pricing'
+ preLoaderRoute: typeof marketingPricingRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/(marketing)/promo': {
+ id: '/(marketing)/promo'
+ path: '/promo'
+ fullPath: '/promo'
+ preLoaderRoute: typeof marketingPromoRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/_layout/alpha': {
+ id: '/_layout/alpha'
+ path: '/alpha'
+ fullPath: '/alpha'
+ preLoaderRoute: typeof LayoutAlphaRouteImport
+ parentRoute: typeof LayoutRoute
+ }
+ '/_layout/beta': {
+ id: '/_layout/beta'
+ path: '/beta'
+ fullPath: '/beta'
+ preLoaderRoute: typeof LayoutBetaRouteImport
+ parentRoute: typeof LayoutRoute
+ }
+ '/files/$': {
+ id: '/files/$'
+ path: '/files/$'
+ fullPath: '/files/$'
+ preLoaderRoute: typeof FilesSplatRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/release/v{$version}': {
+ id: '/release/v{$version}'
+ path: '/release/v{$version}'
+ fullPath: '/release/v{$version}'
+ preLoaderRoute: typeof ReleaseVChar123versionChar125RouteImport
+ parentRoute: typeof rootRouteImport
}
'/sec-a/': {
id: '/sec-a/'
@@ -582,125 +589,6 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof SecAIndexRouteImport
parentRoute: typeof SecARoute
}
- '/sec-f/settings': {
- id: '/sec-f/settings'
- path: '/settings'
- fullPath: '/sec-f/settings'
- preLoaderRoute: typeof SecFSettingsRouteImport
- parentRoute: typeof SecFRoute
- }
- '/sec-f/about': {
- id: '/sec-f/about'
- path: '/about'
- fullPath: '/sec-f/about'
- preLoaderRoute: typeof SecFAboutRouteImport
- parentRoute: typeof SecFRoute
- }
- '/sec-f/$id': {
- id: '/sec-f/$id'
- path: '/$id'
- fullPath: '/sec-f/$id'
- preLoaderRoute: typeof SecFIdRouteImport
- parentRoute: typeof SecFRoute
- }
- '/sec-e/settings': {
- id: '/sec-e/settings'
- path: '/settings'
- fullPath: '/sec-e/settings'
- preLoaderRoute: typeof SecESettingsRouteImport
- parentRoute: typeof SecERoute
- }
- '/sec-e/about': {
- id: '/sec-e/about'
- path: '/about'
- fullPath: '/sec-e/about'
- preLoaderRoute: typeof SecEAboutRouteImport
- parentRoute: typeof SecERoute
- }
- '/sec-e/$id': {
- id: '/sec-e/$id'
- path: '/$id'
- fullPath: '/sec-e/$id'
- preLoaderRoute: typeof SecEIdRouteImport
- parentRoute: typeof SecERoute
- }
- '/sec-d/settings': {
- id: '/sec-d/settings'
- path: '/settings'
- fullPath: '/sec-d/settings'
- preLoaderRoute: typeof SecDSettingsRouteImport
- parentRoute: typeof SecDRoute
- }
- '/sec-d/about': {
- id: '/sec-d/about'
- path: '/about'
- fullPath: '/sec-d/about'
- preLoaderRoute: typeof SecDAboutRouteImport
- parentRoute: typeof SecDRoute
- }
- '/sec-d/$id': {
- id: '/sec-d/$id'
- path: '/$id'
- fullPath: '/sec-d/$id'
- preLoaderRoute: typeof SecDIdRouteImport
- parentRoute: typeof SecDRoute
- }
- '/sec-c/settings': {
- id: '/sec-c/settings'
- path: '/settings'
- fullPath: '/sec-c/settings'
- preLoaderRoute: typeof SecCSettingsRouteImport
- parentRoute: typeof SecCRoute
- }
- '/sec-c/about': {
- id: '/sec-c/about'
- path: '/about'
- fullPath: '/sec-c/about'
- preLoaderRoute: typeof SecCAboutRouteImport
- parentRoute: typeof SecCRoute
- }
- '/sec-c/$id': {
- id: '/sec-c/$id'
- path: '/$id'
- fullPath: '/sec-c/$id'
- preLoaderRoute: typeof SecCIdRouteImport
- parentRoute: typeof SecCRoute
- }
- '/sec-b/settings': {
- id: '/sec-b/settings'
- path: '/settings'
- fullPath: '/sec-b/settings'
- preLoaderRoute: typeof SecBSettingsRouteImport
- parentRoute: typeof SecBRoute
- }
- '/sec-b/about': {
- id: '/sec-b/about'
- path: '/about'
- fullPath: '/sec-b/about'
- preLoaderRoute: typeof SecBAboutRouteImport
- parentRoute: typeof SecBRoute
- }
- '/sec-b/$id': {
- id: '/sec-b/$id'
- path: '/$id'
- fullPath: '/sec-b/$id'
- preLoaderRoute: typeof SecBIdRouteImport
- parentRoute: typeof SecBRoute
- }
- '/sec-a/settings': {
- id: '/sec-a/settings'
- path: '/settings'
- fullPath: '/sec-a/settings'
- preLoaderRoute: typeof SecASettingsRouteImport
- parentRoute: typeof SecARoute
- }
- '/sec-a/about': {
- id: '/sec-a/about'
- path: '/about'
- fullPath: '/sec-a/about'
- preLoaderRoute: typeof SecAAboutRouteImport
- parentRoute: typeof SecARoute
- }
'/sec-a/$id': {
id: '/sec-a/$id'
path: '/$id'
@@ -708,47 +596,159 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof SecAIdRouteImport
parentRoute: typeof SecARoute
}
- '/release/v{$version}': {
- id: '/release/v{$version}'
- path: '/release/v{$version}'
- fullPath: '/release/v{$version}'
- preLoaderRoute: typeof ReleaseVChar123versionChar125RouteImport
- parentRoute: typeof rootRouteImport
+ '/sec-a/about': {
+ id: '/sec-a/about'
+ path: '/about'
+ fullPath: '/sec-a/about'
+ preLoaderRoute: typeof SecAAboutRouteImport
+ parentRoute: typeof SecARoute
}
- '/files/$': {
- id: '/files/$'
- path: '/files/$'
- fullPath: '/files/$'
- preLoaderRoute: typeof FilesSplatRouteImport
- parentRoute: typeof rootRouteImport
+ '/sec-a/settings': {
+ id: '/sec-a/settings'
+ path: '/settings'
+ fullPath: '/sec-a/settings'
+ preLoaderRoute: typeof SecASettingsRouteImport
+ parentRoute: typeof SecARoute
}
- '/_layout/beta': {
- id: '/_layout/beta'
- path: '/beta'
- fullPath: '/beta'
- preLoaderRoute: typeof LayoutBetaRouteImport
- parentRoute: typeof LayoutRoute
+ '/sec-b/': {
+ id: '/sec-b/'
+ path: '/'
+ fullPath: '/sec-b/'
+ preLoaderRoute: typeof SecBIndexRouteImport
+ parentRoute: typeof SecBRoute
}
- '/_layout/alpha': {
- id: '/_layout/alpha'
- path: '/alpha'
- fullPath: '/alpha'
- preLoaderRoute: typeof LayoutAlphaRouteImport
- parentRoute: typeof LayoutRoute
+ '/sec-b/$id': {
+ id: '/sec-b/$id'
+ path: '/$id'
+ fullPath: '/sec-b/$id'
+ preLoaderRoute: typeof SecBIdRouteImport
+ parentRoute: typeof SecBRoute
}
- '/(marketing)/promo': {
- id: '/(marketing)/promo'
- path: '/promo'
- fullPath: '/promo'
- preLoaderRoute: typeof marketingPromoRouteImport
- parentRoute: typeof rootRouteImport
+ '/sec-b/about': {
+ id: '/sec-b/about'
+ path: '/about'
+ fullPath: '/sec-b/about'
+ preLoaderRoute: typeof SecBAboutRouteImport
+ parentRoute: typeof SecBRoute
}
- '/(marketing)/pricing': {
- id: '/(marketing)/pricing'
- path: '/pricing'
- fullPath: '/pricing'
- preLoaderRoute: typeof marketingPricingRouteImport
- parentRoute: typeof rootRouteImport
+ '/sec-b/settings': {
+ id: '/sec-b/settings'
+ path: '/settings'
+ fullPath: '/sec-b/settings'
+ preLoaderRoute: typeof SecBSettingsRouteImport
+ parentRoute: typeof SecBRoute
+ }
+ '/sec-c/': {
+ id: '/sec-c/'
+ path: '/'
+ fullPath: '/sec-c/'
+ preLoaderRoute: typeof SecCIndexRouteImport
+ parentRoute: typeof SecCRoute
+ }
+ '/sec-c/$id': {
+ id: '/sec-c/$id'
+ path: '/$id'
+ fullPath: '/sec-c/$id'
+ preLoaderRoute: typeof SecCIdRouteImport
+ parentRoute: typeof SecCRoute
+ }
+ '/sec-c/about': {
+ id: '/sec-c/about'
+ path: '/about'
+ fullPath: '/sec-c/about'
+ preLoaderRoute: typeof SecCAboutRouteImport
+ parentRoute: typeof SecCRoute
+ }
+ '/sec-c/settings': {
+ id: '/sec-c/settings'
+ path: '/settings'
+ fullPath: '/sec-c/settings'
+ preLoaderRoute: typeof SecCSettingsRouteImport
+ parentRoute: typeof SecCRoute
+ }
+ '/sec-d/': {
+ id: '/sec-d/'
+ path: '/'
+ fullPath: '/sec-d/'
+ preLoaderRoute: typeof SecDIndexRouteImport
+ parentRoute: typeof SecDRoute
+ }
+ '/sec-d/$id': {
+ id: '/sec-d/$id'
+ path: '/$id'
+ fullPath: '/sec-d/$id'
+ preLoaderRoute: typeof SecDIdRouteImport
+ parentRoute: typeof SecDRoute
+ }
+ '/sec-d/about': {
+ id: '/sec-d/about'
+ path: '/about'
+ fullPath: '/sec-d/about'
+ preLoaderRoute: typeof SecDAboutRouteImport
+ parentRoute: typeof SecDRoute
+ }
+ '/sec-d/settings': {
+ id: '/sec-d/settings'
+ path: '/settings'
+ fullPath: '/sec-d/settings'
+ preLoaderRoute: typeof SecDSettingsRouteImport
+ parentRoute: typeof SecDRoute
+ }
+ '/sec-e/': {
+ id: '/sec-e/'
+ path: '/'
+ fullPath: '/sec-e/'
+ preLoaderRoute: typeof SecEIndexRouteImport
+ parentRoute: typeof SecERoute
+ }
+ '/sec-e/$id': {
+ id: '/sec-e/$id'
+ path: '/$id'
+ fullPath: '/sec-e/$id'
+ preLoaderRoute: typeof SecEIdRouteImport
+ parentRoute: typeof SecERoute
+ }
+ '/sec-e/about': {
+ id: '/sec-e/about'
+ path: '/about'
+ fullPath: '/sec-e/about'
+ preLoaderRoute: typeof SecEAboutRouteImport
+ parentRoute: typeof SecERoute
+ }
+ '/sec-e/settings': {
+ id: '/sec-e/settings'
+ path: '/settings'
+ fullPath: '/sec-e/settings'
+ preLoaderRoute: typeof SecESettingsRouteImport
+ parentRoute: typeof SecERoute
+ }
+ '/sec-f/': {
+ id: '/sec-f/'
+ path: '/'
+ fullPath: '/sec-f/'
+ preLoaderRoute: typeof SecFIndexRouteImport
+ parentRoute: typeof SecFRoute
+ }
+ '/sec-f/$id': {
+ id: '/sec-f/$id'
+ path: '/$id'
+ fullPath: '/sec-f/$id'
+ preLoaderRoute: typeof SecFIdRouteImport
+ parentRoute: typeof SecFRoute
+ }
+ '/sec-f/about': {
+ id: '/sec-f/about'
+ path: '/about'
+ fullPath: '/sec-f/about'
+ preLoaderRoute: typeof SecFAboutRouteImport
+ parentRoute: typeof SecFRoute
+ }
+ '/sec-f/settings': {
+ id: '/sec-f/settings'
+ path: '/settings'
+ fullPath: '/sec-f/settings'
+ preLoaderRoute: typeof SecFSettingsRouteImport
+ parentRoute: typeof SecFRoute
}
}
}
diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/vite.config.ts b/benchmarks/client-nav/scenarios/route-tree-scale/vue/vite.config.ts
index a547406198..189ba1de99 100644
--- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/route-tree-scale/vue/vite.config.ts
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -37,6 +38,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav route-tree-scale (vue)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts b/benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts
index 5bdd994e32..0b38f7bddb 100644
--- a/benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-search-params', () => {
- const test = setup()
+test('client-search-params', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-search-params navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/search-params/react/vite.config.ts b/benchmarks/client-nav/scenarios/search-params/react/vite.config.ts
index b220ae7d0d..0318a10815 100644
--- a/benchmarks/client-nav/scenarios/search-params/react/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/search-params/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -32,6 +33,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav search-params (react)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts
index ea0baa1098..caa626c596 100644
--- a/benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-search-params', () => {
- const test = setup()
+test('client-search-params', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-search-params navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx b/benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx
index 714d5a0098..25071f7979 100644
--- a/benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx
+++ b/benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx
@@ -1,5 +1,5 @@
import type { RouterHistory } from '@tanstack/history'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { RouterProvider, createRouter } from '@tanstack/solid-router'
import { routeTree } from './routeTree.gen'
diff --git a/benchmarks/client-nav/scenarios/search-params/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/search-params/solid/src/routeTree.gen.ts
index 96d211d64c..b15beed09b 100644
--- a/benchmarks/client-nav/scenarios/search-params/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/search-params/solid/src/routeTree.gen.ts
@@ -9,13 +9,13 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as ProductsRouteImport } from './routes/products'
-import { Route as CatalogRouteImport } from './routes/catalog'
import { Route as IndexRouteImport } from './routes/index'
+import { Route as CatalogRouteImport } from './routes/catalog'
+import { Route as ProductsRouteImport } from './routes/products'
-const ProductsRoute = ProductsRouteImport.update({
- id: '/products',
- path: '/products',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const CatalogRoute = CatalogRouteImport.update({
@@ -23,9 +23,9 @@ const CatalogRoute = CatalogRouteImport.update({
path: '/catalog',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const ProductsRoute = ProductsRouteImport.update({
+ id: '/products',
+ path: '/products',
getParentRoute: () => rootRouteImport,
} as any)
@@ -61,11 +61,11 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/products': {
- id: '/products'
- path: '/products'
- fullPath: '/products'
- preLoaderRoute: typeof ProductsRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/catalog': {
@@ -75,11 +75,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof CatalogRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/products': {
+ id: '/products'
+ path: '/products'
+ fullPath: '/products'
+ preLoaderRoute: typeof ProductsRouteImport
parentRoute: typeof rootRouteImport
}
}
diff --git a/benchmarks/client-nav/scenarios/search-params/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/search-params/solid/src/routes/__root.tsx
index e6f9592e07..30c042f9c5 100644
--- a/benchmarks/client-nav/scenarios/search-params/solid/src/routes/__root.tsx
+++ b/benchmarks/client-nav/scenarios/search-params/solid/src/routes/__root.tsx
@@ -18,12 +18,9 @@ export const Route = createRootRoute({
const rootSubscribers = Array.from({ length: 4 }, (_, index) => index)
function PerfValue(props: { value: () => number }) {
- createRenderEffect(
- () => {
- void props.value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void props.value()
+ })
return null
}
diff --git a/benchmarks/client-nav/scenarios/search-params/solid/src/routes/catalog.tsx b/benchmarks/client-nav/scenarios/search-params/solid/src/routes/catalog.tsx
index 7f3fcf7078..60cf8e7896 100644
--- a/benchmarks/client-nav/scenarios/search-params/solid/src/routes/catalog.tsx
+++ b/benchmarks/client-nav/scenarios/search-params/solid/src/routes/catalog.tsx
@@ -19,12 +19,9 @@ export const Route = createFileRoute('/catalog')({
const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index)
function PerfValue(props: { value: () => number }) {
- createRenderEffect(
- () => {
- void props.value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void props.value()
+ })
return null
}
diff --git a/benchmarks/client-nav/scenarios/search-params/solid/src/routes/products.tsx b/benchmarks/client-nav/scenarios/search-params/solid/src/routes/products.tsx
index 1319aabae3..8b2a252155 100644
--- a/benchmarks/client-nav/scenarios/search-params/solid/src/routes/products.tsx
+++ b/benchmarks/client-nav/scenarios/search-params/solid/src/routes/products.tsx
@@ -37,12 +37,9 @@ export const Route = createFileRoute('/products')({
const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index)
function PerfValue(props: { value: () => number }) {
- createRenderEffect(
- () => {
- void props.value()
- },
- () => {},
- )
+ createRenderEffect(() => {
+ void props.value()
+ })
return null
}
diff --git a/benchmarks/client-nav/scenarios/search-params/solid/tsconfig.json b/benchmarks/client-nav/scenarios/search-params/solid/tsconfig.json
index 8c57ff876a..98d76ad6b8 100644
--- a/benchmarks/client-nav/scenarios/search-params/solid/tsconfig.json
+++ b/benchmarks/client-nav/scenarios/search-params/solid/tsconfig.json
@@ -2,7 +2,7 @@
"extends": "../../../../../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"allowImportingTsExtensions": true,
"types": ["node", "vite/client", "vitest/globals"]
},
diff --git a/benchmarks/client-nav/scenarios/search-params/solid/vite.config.ts b/benchmarks/client-nav/scenarios/search-params/solid/vite.config.ts
index e404b55b51..511fd49466 100644
--- a/benchmarks/client-nav/scenarios/search-params/solid/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/search-params/solid/vite.config.ts
@@ -1,8 +1,9 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -19,7 +20,7 @@ export default defineConfig({
routesDirectory: `${rootDir}src/routes`,
generatedRouteTree: `${rootDir}src/routeTree.gen.ts`,
}),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -35,6 +36,7 @@ export default defineConfig({
conditions: ['solid', 'browser'],
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav search-params (solid)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts
index c82efd49c9..728d2779e8 100644
--- a/benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-search-params', () => {
- const test = setup()
+test('client-search-params', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-search-params navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/search-params/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/search-params/vue/src/routeTree.gen.ts
index b95b667803..f73b84ebe7 100644
--- a/benchmarks/client-nav/scenarios/search-params/vue/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/search-params/vue/src/routeTree.gen.ts
@@ -9,13 +9,13 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as ProductsRouteImport } from './routes/products'
-import { Route as CatalogRouteImport } from './routes/catalog'
import { Route as IndexRouteImport } from './routes/index'
+import { Route as CatalogRouteImport } from './routes/catalog'
+import { Route as ProductsRouteImport } from './routes/products'
-const ProductsRoute = ProductsRouteImport.update({
- id: '/products',
- path: '/products',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const CatalogRoute = CatalogRouteImport.update({
@@ -23,9 +23,9 @@ const CatalogRoute = CatalogRouteImport.update({
path: '/catalog',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const ProductsRoute = ProductsRouteImport.update({
+ id: '/products',
+ path: '/products',
getParentRoute: () => rootRouteImport,
} as any)
@@ -61,11 +61,11 @@ export interface RootRouteChildren {
declare module '@tanstack/vue-router' {
interface FileRoutesByPath {
- '/products': {
- id: '/products'
- path: '/products'
- fullPath: '/products'
- preLoaderRoute: typeof ProductsRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/catalog': {
@@ -75,11 +75,11 @@ declare module '@tanstack/vue-router' {
preLoaderRoute: typeof CatalogRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/products': {
+ id: '/products'
+ path: '/products'
+ fullPath: '/products'
+ preLoaderRoute: typeof ProductsRouteImport
parentRoute: typeof rootRouteImport
}
}
diff --git a/benchmarks/client-nav/scenarios/search-params/vue/vite.config.ts b/benchmarks/client-nav/scenarios/search-params/vue/vite.config.ts
index 9a3b82d066..27490b276a 100644
--- a/benchmarks/client-nav/scenarios/search-params/vue/vite.config.ts
+++ b/benchmarks/client-nav/scenarios/search-params/vue/vite.config.ts
@@ -4,6 +4,7 @@ import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { cpuSimulationExecArgv } from '../../../../cpu-simulation'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -34,6 +35,7 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav search-params (vue)',
watch: false,
environment: 'jsdom',
diff --git a/benchmarks/client-nav/solid/app.tsx b/benchmarks/client-nav/solid/app.tsx
index 4779054bec..ef90130f5e 100644
--- a/benchmarks/client-nav/solid/app.tsx
+++ b/benchmarks/client-nav/solid/app.tsx
@@ -1,5 +1,5 @@
import { For, createRenderEffect } from 'solid-js'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import {
Link,
Outlet,
@@ -37,10 +37,9 @@ const routeSelectors = Array.from({ length: 6 }, (_, index) => index)
const linkGroups = Array.from({ length: 4 }, (_, index) => index)
function PerfValue(props: { value: () => number }) {
- createRenderEffect(
- () => props.value(),
- () => {},
- )
+ createRenderEffect(() => {
+ void props.value()
+ })
return null
}
@@ -67,8 +66,7 @@ function LinkPanel() {
return (
<>
- {(groupIndexAccessor) => {
- const groupIndex = groupIndexAccessor
+ {(groupIndex) => {
const itemsId = groupIndex === 0 ? 1 : groupIndex + 2
const ctxId = groupIndex + 1
diff --git a/benchmarks/client-nav/solid/speed.bench.ts b/benchmarks/client-nav/solid/speed.bench.ts
index 34791180ce..d629da17a8 100644
--- a/benchmarks/client-nav/solid/speed.bench.ts
+++ b/benchmarks/client-nav/solid/speed.bench.ts
@@ -1,34 +1,19 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
+import { test } from 'vitest'
import { setup } from './setup'
-describe('client-nav', () => {
- const test = setup()
+test('client-nav', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores "suite hooks" like `beforeAll` and `afterAll`,
- * so we use tinybench's `setup` and `teardown` options to run our setup and teardown logic.
- *
- * But CodSpeed calls the benchmarked function directly, bypassing `setup` and `teardown`,
- * but it does support `beforeAll` and `afterAll`.
- *
- * So it looks like we're setting up in duplicate, but in reality, it's only running once per environment, as intended.
- */
-
- beforeAll(test.before)
- afterAll(test.after)
-
- bench(
+ await bench(
'client-side navigation loop (solid)',
+ { beforeAll: scenario.before, afterAll: scenario.after },
async () => {
for (let i = 0; i < 10; i++) {
- await test.tick()
+ await scenario.tick()
}
},
- {
- warmupIterations: 100,
- time: 10_000,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run({
+ warmupIterations: 100,
+ time: 10_000,
+ })
})
diff --git a/benchmarks/client-nav/solid/tsconfig.json b/benchmarks/client-nav/solid/tsconfig.json
index aa3cfb2444..4c500d0793 100644
--- a/benchmarks/client-nav/solid/tsconfig.json
+++ b/benchmarks/client-nav/solid/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"jsx": "preserve",
"allowImportingTsExtensions": true,
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
diff --git a/benchmarks/client-nav/solid/vite.config.ts b/benchmarks/client-nav/solid/vite.config.ts
index 57c23312a5..0c26b32f5f 100644
--- a/benchmarks/client-nav/solid/vite.config.ts
+++ b/benchmarks/client-nav/solid/vite.config.ts
@@ -1,7 +1,8 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
import codspeedPlugin from '@codspeed/vitest-plugin'
+import { cpuSimulationExecArgv } from '../../cpu-simulation'
// Anchor the project root to the package directory so this config resolves
// identically when run directly and as part of an aggregate `projects` config.
@@ -15,7 +16,7 @@ export default defineConfig({
plugins: [
!!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&
codspeedPlugin(),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './solid/dist',
@@ -31,10 +32,12 @@ export default defineConfig({
conditions: ['solid', 'browser'],
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav (solid)',
watch: false,
environment: 'jsdom',
setupFiles: [`${rootDir}vitest.setup.ts`],
+ benchmark: { include: ['solid/speed.bench.ts'] },
server: {
deps: {
inline: [/@solidjs/, /@tanstack\/solid-store/],
diff --git a/benchmarks/client-nav/vue/speed.bench.ts b/benchmarks/client-nav/vue/speed.bench.ts
index f9e532f5ba..503e91e7b7 100644
--- a/benchmarks/client-nav/vue/speed.bench.ts
+++ b/benchmarks/client-nav/vue/speed.bench.ts
@@ -1,34 +1,19 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
+import { test } from 'vitest'
import { setup } from './setup'
-describe('client-nav', () => {
- const test = setup()
+test('client-nav', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores "suite hooks" like `beforeAll` and `afterAll`,
- * so we use tinybench's `setup` and `teardown` options to run our setup and teardown logic.
- *
- * But CodSpeed calls the benchmarked function directly, bypassing `setup` and `teardown`,
- * but it does support `beforeAll` and `afterAll`.
- *
- * So it looks like we're setting up in duplicate, but in reality, it's only running once per environment, as intended.
- */
-
- beforeAll(test.before)
- afterAll(test.after)
-
- bench(
+ await bench(
'client-side navigation loop (vue)',
+ { beforeAll: scenario.before, afterAll: scenario.after },
async () => {
for (let i = 0; i < 10; i++) {
- await test.tick()
+ await scenario.tick()
}
},
- {
- warmupIterations: 100,
- time: 10_000,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run({
+ warmupIterations: 100,
+ time: 10_000,
+ })
})
diff --git a/benchmarks/client-nav/vue/vite.config.ts b/benchmarks/client-nav/vue/vite.config.ts
index 4c44c09fdd..78d8ae5638 100644
--- a/benchmarks/client-nav/vue/vite.config.ts
+++ b/benchmarks/client-nav/vue/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import codspeedPlugin from '@codspeed/vitest-plugin'
+import { cpuSimulationExecArgv } from '../../cpu-simulation'
// Anchor the project root to the package directory so this config resolves
// identically when run directly and as part of an aggregate `projects` config.
@@ -30,9 +31,11 @@ export default defineConfig({
},
},
test: {
+ execArgv: cpuSimulationExecArgv(),
name: '@benchmarks/client-nav (vue)',
watch: false,
environment: 'jsdom',
setupFiles: [`${rootDir}vitest.setup.ts`],
+ benchmark: { include: ['vue/speed.bench.ts'] },
},
})
diff --git a/benchmarks/cpu-simulation.ts b/benchmarks/cpu-simulation.ts
new file mode 100644
index 0000000000..9b8859f74d
--- /dev/null
+++ b/benchmarks/cpu-simulation.ts
@@ -0,0 +1,53 @@
+function codspeedRunnerMode() {
+ return process.env.CODSPEED_ENV === undefined
+ ? undefined
+ : process.env.CODSPEED_RUNNER_MODE
+}
+
+/**
+ * Whether CodSpeed's simulation or memory instrument drives the run. Both
+ * measure one invocation after a few warmup calls instead of sampling.
+ */
+export function isCodSpeedAnalysis() {
+ const mode = codspeedRunnerMode()
+ return (
+ mode === 'simulation' || mode === 'instrumentation' || mode === 'memory'
+ )
+}
+
+/** Extra worker flags for CodSpeed CPU simulation, not walltime benchmarks. */
+export function cpuSimulationExecArgv() {
+ const mode = codspeedRunnerMode()
+ if (mode === 'simulation' || mode === 'instrumentation') {
+ // CodSpeed supplies --no-opt, which only disables TurboFan on Node 24.
+ // Maglev can still compile and inline hot functions between measured runs.
+ // Compile baseline code on first use, so warmup does not leave functions
+ // near Sparkplug's later tier-up/batch-compilation thresholds.
+ // V8 renamed --scavenge-task in Node 20; CodSpeed's old flag is omitted.
+ // Keep minor GC tied to allocations instead of scheduled foreground tasks.
+ // Fix the initial/minimum old-generation allocation budget. This can skip
+ // automatic full collections below the budget; minor GC remains enabled.
+ return [
+ '--no-maglev',
+ '--always-sparkplug',
+ '--no-minor-gc-task',
+ '--initial-old-space-size=512',
+ ]
+ }
+ return []
+}
+
+/**
+ * Per-bench lifecycle for apps that a bench prepares and disposes outside
+ * timing. CodSpeed measures one invocation, so each invocation gets fresh
+ * state. Tinybench samples thousands of iterations and keeps one instance per
+ * warmup/run phase instead of preparing it for every iteration.
+ */
+export function benchLifecycle(hooks: {
+ before: () => Promise | void
+ after: () => Promise | void
+}) {
+ return isCodSpeedAnalysis()
+ ? { beforeEach: hooks.before, afterEach: hooks.after }
+ : { beforeAll: hooks.before, afterAll: hooks.after }
+}
diff --git a/benchmarks/memory/README.md b/benchmarks/memory/README.md
index cf871f3439..18b68768f9 100644
--- a/benchmarks/memory/README.md
+++ b/benchmarks/memory/README.md
@@ -2,7 +2,7 @@
Dedicated memory benchmarks for TanStack Router / Start, measured with the
CodSpeed **memory instrument** (`mode: memory` in
-`.github/workflows/client-nav-benchmarks.yml`). The workflow runs on every
+`.github/workflows/benchmarks.yml`). The workflow runs on every
push to `main` except docs/examples/e2e-only pushes: CodSpeed compares a PR
against the run on its merge-base commit, and a main commit without a run makes
CodSpeed silently fall back to an older base — a single outlier base run then
@@ -34,8 +34,8 @@ benchmarks/memory//
One app per scenario; apps and bench names are stable once landed (CodSpeed
continuity). Never grow an existing scenario for a new case — add a scenario.
`setup.ts` imports the built app and exports the concrete workload;
-`memory.bench.ts` registers `bench(...)` directly, and `memory.flame.ts` runs the
-same workload through the Flame profiler.
+`memory.bench.ts` registers it with Vitest's `bench` test fixture, and
+`memory.flame.ts` runs the same workload through the Flame profiler.
## How the memory instrument executes a bench
@@ -43,40 +43,98 @@ same workload through the Flame profiler.
after a forced GC. Under plain `vitest bench` the suites only smoke-test:
timing output is meaningless; real numbers come from CodSpeed.
- Under CodSpeed the bench fn runs several warmup invocations plus the
- measured one **on the same mount**, so bench fns must be idempotent and
- module-level counters/LCGs are used where ids must never repeat across
- invocations.
-- Plain `vitest bench` never runs suite hooks (`beforeAll`/`afterAll`) and
- only honors tinybench's `setup`/`teardown` options; the CodSpeed runner
- does the exact opposite. Client benches therefore register **both** — in
- any given mode exactly one pair runs.
-- The process runs with V8 determinism flags (predictable GC schedule,
- `--no-opt`). Never call `global.gc()` manually in **churn** scenarios —
- their signal is accumulation across iterations, which a forced collection
- masks. **Peak** scenarios do the opposite: they set
- `pinGcBetweenIterations` on the request loop so a collection runs between
- iterations. Their signal is the footprint of a single request, and without
- pinned GC points the measured peak flips by a whole payload depending on
- whether iteration i's garbage is collected before iteration i+1 allocates.
- Because of `--no-opt`, allocation counts overstate production; numbers are
- for regression tracking, not absolute claims.
+ measured one. The bench's `beforeEach`/`afterEach` hooks
+ (`memoryBenchHooks`) run around every invocation, outside the measurement
+ window: client workloads mount a fresh app before each invocation and tear
+ it down afterward. This prevents warmup navigation history and caches from
+ changing the starting state. Plain `vitest bench` runs the same hooks around
+ its warmup and measured iteration. Module-level counters/LCGs keep generated
+ URLs unique across invocations.
+- Workload `run` functions must be `async` functions. CodSpeed's Vitest 5
+ provider awaits only `AsyncFunction`s; a plain function that returns a
+ promise would be measured only up to its first suspension.
+- Worker flags live in `runtime.ts` and apply only to the CodSpeed memory
+ instrument. They supplement the integration's predictable execution flags;
+ the retained overrides are described below.
+- Before each CodSpeed invocation, the `beforeEach` hook yields to the event
+ loop, outside the measurement marker and before CodSpeed forces GC. Promise-only
+ warmup chains can keep WeakRef targets alive through a collection in the same
+ job. Client app setup also runs before the forced GC.
+- Do not force GC inside a measured request loop or poll `heapUsed` to choose
+ how much work to do. Both introduce allocator activity from the harness into
+ the measurement. Footprint scenarios run exactly one large request per
+ invocation; churn scenarios retain their fixed sequential request counts.
+- Error-path cases use separate isolated workers so one case's module and
+ allocator history cannot contaminate the next case.
- Keep each bench under **~1.5M allocations** (instrument overhead grows past
2M); this is the main constraint when tuning iteration counts.
+## Worker settings
+
+All scenarios use [`memoryConfig`](./runtime.ts). It adds these flags only in
+memory mode:
+
+- `--no-maglev`
+- `--no-flush-bytecode`
+- `--no-minor-gc-task`
+- `--no-incremental-marking`
+- `--initial-old-space-size=512`
+
+`--jitless` was removed after repeated CI comparisons. Ten unchanged-commit
+repetitions with the last four flags kept all 48 peak-memory results within 1%
+(worst spread: 0.834%). With JIT enabled, all 16 subsets of the four flags were
+tested. Removing bytecode, minor-GC-task, incremental-marking, or heap-budget
+overrides from this profile produced worst client peak spreads of 6.616%, 2.714%,
+2.109%, and 10.669%, respectively. Smaller combinations also exceeded 1% in at
+least one tracked metric. This supports retaining the four-flag profile; it does
+not establish that every override is required in every individual scenario.
+
+A server-only heap-budget profile initially passed five repetitions, but further
+confirmation produced a 24.46% server peak outlier. That configuration was
+rejected. Allocated bytes and allocation counts remain imperfectly repeatable:
+a client confirmation with the retained four flags showed a 6.77% allocated-byte
+spread and a 5.91% allocation-count spread. Client peaks remained within 0.834%
+across all 15 observations with the retained profile. Experiment details and CI runs are recorded in
+[PR #8260](https://github.com/TanStack/router/pull/8260).
+
+These settings trade production GC behavior for repeatable regression signals.
+They suppress bytecode reclamation and change collection scheduling. The 512 MiB
+initial/minimum old-generation allocation budget can postpone automatic full
+collections. This does not preallocate 512 MiB, and the smallest sufficient budget
+was not determined. Results describe this controlled worker profile, not a
+production application's absolute memory footprint.
+
+CodSpeed's `--no-opt` only disables TurboFan on Node 24 (V8 13); Maglev still
+compiles. Under CodSpeed's `--predictable` there is no background compilation,
+so Maglev compiles run synchronously inside whichever request triggers them, and
+the forced GC before the measured call can discard optimized code so recompiles
+land inside the measured window. Maglev's malloc'd Zone scratch (32 KiB
+segments) then dominates allocation metrics, and its size depends on
+per-process feedback state. `--no-maglev` was added for this: the bimodal
++32,792 B / +1 allocation in `mem server error-paths unmatched (react)` was one
+Maglev Zone segment allocated while compiling React Fizz's per-request stream
+`write` closure, and compiler scratch made up ~97% of that bench's allocated
+bytes. Retained-object measurements are unaffected because Zone memory is freed
+after each compile. The repeatability figures above predate this flag.
+
## Bench shapes and signals
-- **Churn (leak detector):** N sequential iterations at steady state. If one
- iteration leaks L bytes, peak grows by ~N·L; healthy builds show a flat
- timeline floor independent of N. Tuning check: doubling N must leave peak
- roughly unchanged.
-- **Peak (footprint):** one (or very few) large operations; peak memory
- scaling with the workload is the signal.
+- **Churn:** a fixed number of sequential operations, measuring native
+ allocation activity and peak outstanding native allocations.
+- **Peak (footprint):** one large operation, measuring its native footprint.
+
+CodSpeed reports native allocator activity, not individual JavaScript object
+allocations or retained JS heap size. V8 can reuse heap pages without a visible
+native allocation. These benchmarks can detect native buffering and allocator
+regressions, but a flat graph does not establish that route data or JS objects
+are collectable. Absolute numbers include Node/framework/jsdom activity under
+benchmark-specific V8 settings; compare identical harness versions.
## Scenarios
### Server
-| Scenario | Shape | Guards against |
+| Scenario | Shape | Exercises |
| ----------------------- | ----- | --------------------------------------------------------- |
| `request-churn` | churn | cross-request retention in document SSR (unique URLs) |
| `server-fn-churn` | churn | retention in the server-function RPC path |
@@ -88,7 +146,7 @@ same workload through the Flame profiler.
### Client
-| Scenario | Shape | Guards against |
+| Scenario | Shape | Exercises |
| ------------------------- | ----- | -------------------------------------------------------- |
| `navigation-churn` | churn | per-navigation retention at steady state |
| `unique-location-churn` | churn | unbounded href/search-keyed caches (never-repeated URLs) |
@@ -103,14 +161,10 @@ same workload through the Flame profiler.
server response is fully consumed before the next request. Pairing a single
navigation with its render signal via `Promise.all([navigate, rendered])`
is fine — never overlap distinct work items.
-- Randomness only via the seeded LCG in `bench-utils.ts`; no `Math.random`,
- `Date.now`, or timers with a nonzero delay — anywhere async ordering must be
- staged (`streaming-peak`'s deferred sections, `aborted-requests`' deferred
- loader data and post-abort drain), chain **0ms `setTimeout` hops** and count
- event-loop turns instead. A wall-clock delay races renderer work differently
- depending on runner load and instrumentation overhead, which makes the
- single measured run non-reproducible; 0ms hops fire in registration order in
- the timers phase, so the interleaving is a pure function of the schedule.
+- Randomness only via the seeded LCG in `bench-utils.ts`. Deferred streaming
+ uses counted zero-delay timer hops to stage work. Timers still depend on the
+ event loop, so validate repeatability on CI instead of assuming deterministic
+ ordering from a zero delay alone.
- Sanity assertions run once at module load and throw on wrong
status/markers, so a bench can never silently measure the wrong thing.
- Server requests follow `benchmarks/ssr` conventions: document GETs send
@@ -184,7 +238,7 @@ pnpm --filter @benchmarks/memory-client clean:profiles
```
Client memory benches are useful for regression tracking of router/React/jsdom
-integration behavior, especially retained route/cache data. They are not pure
+integration behavior and native allocation activity. They are not pure
browser-memory measurements, and local Flame attribution can include jsdom,
React DOM, and profiler shutdown frames.
@@ -200,3 +254,20 @@ WITH_INSTRUMENTATION=1 codspeed run --mode memory -- pnpm nx run @benchmarks/mem
WITH_INSTRUMENTATION=1 codspeed run --mode memory -- pnpm nx run @benchmarks/memory-client:test:perf:solid
WITH_INSTRUMENTATION=1 codspeed run --mode memory -- pnpm nx run @benchmarks/memory-client:test:perf:vue
```
+
+Run the benchmark workflow on an experiment branch:
+
+```bash
+gh workflow run benchmarks.yml --ref
+```
+
+Repeat at the same commit, using distinct branch names if runs should overlap
+(the workflow serializes runs on the same ref). Compare all 48 fresh memory
+results: 18 client and 30 server. Exclude CPU simulation results, inherited
+CodSpeed results, and failed or incomplete repetitions. For each workload, calculate
+`100 * (max / min - 1)` across runs for peak bytes, allocated bytes, and
+allocation counts; aggregate averages hide unstable cases.
+
+Observed spreads below 1% establish repeatability in the tested sample, not a
+bound on future runs. Changes to worker flags or workload lifecycles establish
+new measurement baselines.
diff --git a/benchmarks/memory/client/bench-utils.ts b/benchmarks/memory/client/bench-utils.ts
index 0cbaedbd71..785e8fac7f 100644
--- a/benchmarks/memory/client/bench-utils.ts
+++ b/benchmarks/memory/client/bench-utils.ts
@@ -1,3 +1,5 @@
+export { memoryBenchHooks } from '../turn'
+
export const memoryBenchOptions = {
iterations: 1,
warmupIterations: 1,
diff --git a/benchmarks/memory/client/benchmark.ts b/benchmarks/memory/client/benchmark.ts
index 8b877b0740..463047f4d9 100644
--- a/benchmarks/memory/client/benchmark.ts
+++ b/benchmarks/memory/client/benchmark.ts
@@ -1,6 +1,10 @@
export interface ClientMemoryWorkload {
name: string
before?: () => Promise | void
+ /**
+ * Must be an `async` function: CodSpeed's Vitest 5 provider awaits only
+ * `AsyncFunction`s and otherwise measures just the synchronous part.
+ */
run: () => Promise | void
sanity: () => Promise | void
after?: () => Promise | void
diff --git a/benchmarks/memory/client/package.json b/benchmarks/memory/client/package.json
index 5c67b9118a..4dc6246183 100644
--- a/benchmarks/memory/client/package.json
+++ b/benchmarks/memory/client/package.json
@@ -12,31 +12,32 @@
"#memory-client/lifecycle": "./lifecycle.ts"
},
"dependencies": {
- "@solidjs/web": "^2.0.0-rc.20",
"@tanstack/react-router": "workspace:*",
"@tanstack/router-core": "workspace:*",
"@tanstack/solid-router": "workspace:*",
"@tanstack/vue-router": "workspace:*",
"react": "^19.0.0",
"react-dom": "^19.0.0",
- "solid-js": "^2.0.0-rc.20",
+ "solid-js": "^1.9.10",
"vue": "^3.5.16"
},
"devDependencies": {
- "@codspeed/vitest-plugin": "^5.5.0",
+ "@codspeed/vitest-plugin": "^6.0.1",
"@datadog/pprof": "^5.13.2",
"@platformatic/flame": "^1.6.0",
- "@solidjs/vite-plugin": "^3.0.0-next.54",
"@testing-library/react": "^16.2.0",
"@vitejs/plugin-react": "^6.0.1",
"@vitejs/plugin-vue": "^6.0.5",
"@vitejs/plugin-vue-jsx": "^5.1.5",
"@types/jsdom": "28.0.0",
+ "@types/react": "catalog:",
+ "@types/react-dom": "catalog:",
"jsdom": "29.1.1",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14",
- "vitest": "^4.1.4"
+ "vite-plugin-solid": "^2.11.11",
+ "vitest": "catalog:"
},
"nx": {
"targets": {
@@ -201,7 +202,7 @@
"build:react"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.react.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.react.config.ts",
"cwd": "benchmarks/memory/client"
}
},
@@ -213,7 +214,7 @@
"build:solid"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.solid.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.solid.config.ts",
"cwd": "benchmarks/memory/client"
}
},
@@ -225,12 +226,12 @@
"build:vue"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.vue.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.vue.config.ts",
"cwd": "benchmarks/memory/client"
}
},
"test:types": {
- "executor": "nx:noop",
+ "executor": "nx:run-commands",
"dependsOn": [
{
"projects": [
@@ -255,6 +256,17 @@
],
"target": "test:types:client"
}
+ ],
+ "options": {
+ "command": "tsc -p ./tsconfig.json --noEmit",
+ "cwd": "benchmarks/memory/client"
+ },
+ "inputs": [
+ "default",
+ "^production",
+ "{workspaceRoot}/eslint.config.js",
+ "dependentTaskOutputs",
+ "{workspaceRoot}/benchmarks/memory/*.ts"
]
}
}
diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/memory.bench.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/react/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/interrupted-navigations/react/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/vite.config.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/react/vite.config.ts
index 048a9cc833..0f05cedf40 100644
--- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/interrupted-navigations/react/vite.config.ts
@@ -2,6 +2,7 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import react from '@vitejs/plugin-react'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -26,9 +27,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client interrupted-navigations (react)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/app.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/app.tsx
index 9264e1cc51..6288b5fab1 100644
--- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/app.tsx
+++ b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/app.tsx
@@ -1,5 +1,5 @@
import { RouterProvider } from '@tanstack/solid-router'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { getRouter } from './router'
export {
diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/tsconfig.json b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/tsconfig.json
index 9558353c88..b12dcb7ade 100644
--- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/tsconfig.json
+++ b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"jsx": "preserve",
"allowImportingTsExtensions": true,
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/vite.config.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/vite.config.ts
index d7c4a8d9d2..26ff0b5c8c 100644
--- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/vite.config.ts
@@ -1,7 +1,8 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -13,7 +14,7 @@ export default defineConfig({
plugins: [
!!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&
codspeedPlugin(),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -26,9 +27,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client interrupted-navigations (solid)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/fast.$id.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/fast.$id.tsx
index 3bd820bd07..f6dc9ac3bd 100644
--- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/fast.$id.tsx
+++ b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/fast.$id.tsx
@@ -1,6 +1,19 @@
+import { defineComponent } from 'vue'
import { createFileRoute } from '@tanstack/vue-router'
import { fixedTimestamp } from '../../../slow-loaders'
+const FastComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => (
+
+ {`${data.value.kind}:${data.value.id}:${data.value.ts}`}
+
+ )
+ },
+})
+
export const Route = createFileRoute('/fast/$id')({
loader: ({ params }: { params: { id: string } }) => ({
id: params.id,
@@ -9,13 +22,3 @@ export const Route = createFileRoute('/fast/$id')({
}),
component: FastComponent,
})
-
-function FastComponent() {
- const data = Route.useLoaderData()
-
- return (
-
- {`${data.value.kind}:${data.value.id}:${data.value.ts}`}
-
- )
-}
diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/slow.$id.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/slow.$id.tsx
index 68885fb918..3b5bb75ede 100644
--- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/slow.$id.tsx
+++ b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/slow.$id.tsx
@@ -1,6 +1,19 @@
+import { defineComponent } from 'vue'
import { createFileRoute } from '@tanstack/vue-router'
import { getSlowLoaderDeferred } from '../../../slow-loaders'
+const SlowComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => (
+
+ {`${data.value.kind}:${data.value.id}:${data.value.ts}`}
+
+ )
+ },
+})
+
export const Route = createFileRoute('/slow/$id')({
loader: async ({ params }: { params: { id: string } }) => {
const deferred = getSlowLoaderDeferred(params.id)
@@ -9,13 +22,3 @@ export const Route = createFileRoute('/slow/$id')({
},
component: SlowComponent,
})
-
-function SlowComponent() {
- const data = Route.useLoaderData()
-
- return (
-
- {`${data.value.kind}:${data.value.id}:${data.value.ts}`}
-
- )
-}
diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/vite.config.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/vite.config.ts
index b2912ce9d1..02574908d2 100644
--- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -28,9 +29,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client interrupted-navigations (vue)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/react/memory.bench.ts b/benchmarks/memory/client/scenarios/loader-data-retention/react/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/loader-data-retention/react/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/loader-data-retention/react/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/react/vite.config.ts b/benchmarks/memory/client/scenarios/loader-data-retention/react/vite.config.ts
index 555e5f5612..8630417936 100644
--- a/benchmarks/memory/client/scenarios/loader-data-retention/react/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/loader-data-retention/react/vite.config.ts
@@ -2,6 +2,7 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import react from '@vitejs/plugin-react'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -26,9 +27,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client loader-data-retention (react)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/loader-data-retention/solid/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/loader-data-retention/solid/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/app.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/app.tsx
index 1b47cda1f9..4315a4b15c 100644
--- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/app.tsx
+++ b/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/app.tsx
@@ -1,5 +1,5 @@
import { RouterProvider } from '@tanstack/solid-router'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { getRouter } from './router'
export { loaderPayloadRecordCount } from '../../loader-data'
diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/tsconfig.json b/benchmarks/memory/client/scenarios/loader-data-retention/solid/tsconfig.json
index 9558353c88..b12dcb7ade 100644
--- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/tsconfig.json
+++ b/benchmarks/memory/client/scenarios/loader-data-retention/solid/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"jsx": "preserve",
"allowImportingTsExtensions": true,
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/vite.config.ts b/benchmarks/memory/client/scenarios/loader-data-retention/solid/vite.config.ts
index b2bcdee643..5dfd5b53fe 100644
--- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/loader-data-retention/solid/vite.config.ts
@@ -1,7 +1,8 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -13,7 +14,7 @@ export default defineConfig({
plugins: [
!!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&
codspeedPlugin(),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -26,9 +27,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client loader-data-retention (solid)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/loader-data-retention/vue/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/loader-data-retention/vue/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/page.$id.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/page.$id.tsx
index 9f4b3c4470..38f1d2614c 100644
--- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/page.$id.tsx
+++ b/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/page.$id.tsx
@@ -1,22 +1,25 @@
+import { defineComponent } from 'vue'
import { createFileRoute } from '@tanstack/vue-router'
import { createLoaderData } from '../../../loader-data'
+const PageComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => (
+
+ {`${data.value.id}:${data.value.records.length}`}
+
+ )
+ },
+})
+
export const Route = createFileRoute('/page/$id')({
loader: ({ params }: { params: { id: string } }) =>
createLoaderData(params.id),
component: PageComponent,
})
-
-function PageComponent() {
- const data = Route.useLoaderData()
-
- return (
-
- {`${data.value.id}:${data.value.records.length}`}
-
- )
-}
diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/vite.config.ts b/benchmarks/memory/client/scenarios/loader-data-retention/vue/vite.config.ts
index bbf2fd02d8..006636eaa0 100644
--- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/loader-data-retention/vue/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -28,9 +29,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client loader-data-retention (vue)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/mount-unmount/react/memory.bench.ts b/benchmarks/memory/client/scenarios/mount-unmount/react/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/mount-unmount/react/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/mount-unmount/react/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/mount-unmount/react/vite.config.ts b/benchmarks/memory/client/scenarios/mount-unmount/react/vite.config.ts
index bb0f3c2e0a..a08352a837 100644
--- a/benchmarks/memory/client/scenarios/mount-unmount/react/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/mount-unmount/react/vite.config.ts
@@ -2,6 +2,7 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import react from '@vitejs/plugin-react'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -26,9 +27,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client mount-unmount (react)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/mount-unmount/solid/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/mount-unmount/solid/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/mount-unmount/solid/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/src/app.tsx b/benchmarks/memory/client/scenarios/mount-unmount/solid/src/app.tsx
index e82e21bd97..b23bc126d5 100644
--- a/benchmarks/memory/client/scenarios/mount-unmount/solid/src/app.tsx
+++ b/benchmarks/memory/client/scenarios/mount-unmount/solid/src/app.tsx
@@ -1,5 +1,5 @@
import { RouterProvider } from '@tanstack/solid-router'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { getRouter } from './router'
export function mountTestApp(container: Element) {
diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/tsconfig.json b/benchmarks/memory/client/scenarios/mount-unmount/solid/tsconfig.json
index 9558353c88..b12dcb7ade 100644
--- a/benchmarks/memory/client/scenarios/mount-unmount/solid/tsconfig.json
+++ b/benchmarks/memory/client/scenarios/mount-unmount/solid/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"jsx": "preserve",
"allowImportingTsExtensions": true,
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/vite.config.ts b/benchmarks/memory/client/scenarios/mount-unmount/solid/vite.config.ts
index d5727728e6..33699639de 100644
--- a/benchmarks/memory/client/scenarios/mount-unmount/solid/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/mount-unmount/solid/vite.config.ts
@@ -1,7 +1,8 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -13,7 +14,7 @@ export default defineConfig({
plugins: [
!!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&
codspeedPlugin(),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -26,9 +27,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client mount-unmount (solid)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/mount-unmount/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/mount-unmount/vue/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/mount-unmount/vue/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/mount-unmount/vue/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/mount-unmount/vue/src/routes/a.tsx b/benchmarks/memory/client/scenarios/mount-unmount/vue/src/routes/a.tsx
index cbcd543ce5..0dd650e1dd 100644
--- a/benchmarks/memory/client/scenarios/mount-unmount/vue/src/routes/a.tsx
+++ b/benchmarks/memory/client/scenarios/mount-unmount/vue/src/routes/a.tsx
@@ -1,12 +1,15 @@
+import { defineComponent } from 'vue'
import { createFileRoute } from '@tanstack/vue-router'
+const AComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => {data.value.id}
+ },
+})
+
export const Route = createFileRoute('/a')({
loader: () => ({ id: 'a' }),
component: AComponent,
})
-
-function AComponent() {
- const data = Route.useLoaderData()
-
- return {data.value.id}
-}
diff --git a/benchmarks/memory/client/scenarios/mount-unmount/vue/vite.config.ts b/benchmarks/memory/client/scenarios/mount-unmount/vue/vite.config.ts
index 0f7573a408..a3f0eeaa8c 100644
--- a/benchmarks/memory/client/scenarios/mount-unmount/vue/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/mount-unmount/vue/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -28,9 +29,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client mount-unmount (vue)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/navigation-churn/react/memory.bench.ts b/benchmarks/memory/client/scenarios/navigation-churn/react/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/navigation-churn/react/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/navigation-churn/react/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/navigation-churn/react/vite.config.ts b/benchmarks/memory/client/scenarios/navigation-churn/react/vite.config.ts
index b05b999297..eef60a658e 100644
--- a/benchmarks/memory/client/scenarios/navigation-churn/react/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/navigation-churn/react/vite.config.ts
@@ -2,6 +2,7 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import react from '@vitejs/plugin-react'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -26,9 +27,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client navigation-churn (react)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/navigation-churn/solid/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/navigation-churn/solid/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/navigation-churn/solid/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/src/app.tsx b/benchmarks/memory/client/scenarios/navigation-churn/solid/src/app.tsx
index 5917ef0191..16000c90a1 100644
--- a/benchmarks/memory/client/scenarios/navigation-churn/solid/src/app.tsx
+++ b/benchmarks/memory/client/scenarios/navigation-churn/solid/src/app.tsx
@@ -1,5 +1,5 @@
import { RouterProvider } from '@tanstack/solid-router'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { getRouter } from './router'
export function mountTestApp(container: Element) {
diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/tsconfig.json b/benchmarks/memory/client/scenarios/navigation-churn/solid/tsconfig.json
index 9558353c88..b12dcb7ade 100644
--- a/benchmarks/memory/client/scenarios/navigation-churn/solid/tsconfig.json
+++ b/benchmarks/memory/client/scenarios/navigation-churn/solid/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"jsx": "preserve",
"allowImportingTsExtensions": true,
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/vite.config.ts b/benchmarks/memory/client/scenarios/navigation-churn/solid/vite.config.ts
index c885d5edcb..7dfb186b2e 100644
--- a/benchmarks/memory/client/scenarios/navigation-churn/solid/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/navigation-churn/solid/vite.config.ts
@@ -1,7 +1,8 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -13,7 +14,7 @@ export default defineConfig({
plugins: [
!!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&
codspeedPlugin(),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -26,9 +27,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client navigation-churn (solid)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/navigation-churn/vue/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/navigation-churn/vue/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/navigation-churn/vue/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/a.tsx b/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/a.tsx
index 183228e748..c1a9cfb244 100644
--- a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/a.tsx
+++ b/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/a.tsx
@@ -1,16 +1,19 @@
+import { defineComponent } from 'vue'
import { createFileRoute } from '@tanstack/vue-router'
const fixedTimestamp = 1_700_000_000_000
+const AComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => (
+ {`${data.value.name}:${data.value.ts}`}
+ )
+ },
+})
+
export const Route = createFileRoute('/a')({
loader: () => ({ name: 'a', ts: fixedTimestamp }),
component: AComponent,
})
-
-function AComponent() {
- const data = Route.useLoaderData()
-
- return (
- {`${data.value.name}:${data.value.ts}`}
- )
-}
diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/b.tsx b/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/b.tsx
index 3a18ec97a9..3a20799f3b 100644
--- a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/b.tsx
+++ b/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/b.tsx
@@ -1,16 +1,19 @@
+import { defineComponent } from 'vue'
import { createFileRoute } from '@tanstack/vue-router'
const fixedTimestamp = 1_700_000_000_000
+const BComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => (
+ {`${data.value.name}:${data.value.ts}`}
+ )
+ },
+})
+
export const Route = createFileRoute('/b')({
loader: () => ({ name: 'b', ts: fixedTimestamp }),
component: BComponent,
})
-
-function BComponent() {
- const data = Route.useLoaderData()
-
- return (
- {`${data.value.name}:${data.value.ts}`}
- )
-}
diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/vite.config.ts b/benchmarks/memory/client/scenarios/navigation-churn/vue/vite.config.ts
index d26ce23d07..b3bdd39dd2 100644
--- a/benchmarks/memory/client/scenarios/navigation-churn/vue/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/navigation-churn/vue/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -28,9 +29,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client navigation-churn (vue)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/preload-churn/react/memory.bench.ts b/benchmarks/memory/client/scenarios/preload-churn/react/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/preload-churn/react/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/preload-churn/react/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/preload-churn/react/vite.config.ts b/benchmarks/memory/client/scenarios/preload-churn/react/vite.config.ts
index f9c426656b..c12995f68e 100644
--- a/benchmarks/memory/client/scenarios/preload-churn/react/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/preload-churn/react/vite.config.ts
@@ -2,6 +2,7 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import react from '@vitejs/plugin-react'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -26,9 +27,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client preload-churn (react)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/preload-churn/shared.ts b/benchmarks/memory/client/scenarios/preload-churn/shared.ts
index 8cea4aca81..68fdfedd3f 100644
--- a/benchmarks/memory/client/scenarios/preload-churn/shared.ts
+++ b/benchmarks/memory/client/scenarios/preload-churn/shared.ts
@@ -35,18 +35,14 @@ type PreloadRouter = {
subscribe: (event: 'onRendered', listener: () => void) => () => void
}
-// Fixed id for the eviction navigations interleaved into the bench loop; its
-// payload is a constant-size steady-state resident, never part of the signal.
+// Reuse one navigation target while evicting the distinct preloaded routes.
const evictionItemId = 'nav-evict'
const preloadChurnIterations = 200
// A navigation commit is what triggers the router's clearExpiredCache --
// preloaded matches (defaultPreloadGcTime: 0) are only evicted then, never
-// during a preload-only loop. Interleaving a navigation every few preloads is
-// what makes the flat floor assert "eviction releases preloaded payloads".
+// during a preload-only loop. Interleave navigation to exercise eviction.
const preloadsPerEvictionNavigation = 10
-// Module-level so ids stay unique across runner invocations on one mount; a
-// per-invocation LCG would replay identical ids, and every preload after the
-// first invocation would dedupe against cachedMatches instead of doing work.
+// Keep generated URLs unique across warmup and measured invocations.
const benchmarkRandom = createDeterministicRandom(0x706c6f61)
let preloadCounter = 0
diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/preload-churn/solid/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/preload-churn/solid/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/preload-churn/solid/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/src/app.tsx b/benchmarks/memory/client/scenarios/preload-churn/solid/src/app.tsx
index b5b0a1d555..18ad5b97e4 100644
--- a/benchmarks/memory/client/scenarios/preload-churn/solid/src/app.tsx
+++ b/benchmarks/memory/client/scenarios/preload-churn/solid/src/app.tsx
@@ -1,5 +1,5 @@
import { RouterProvider } from '@tanstack/solid-router'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { getRouter } from './router'
export { getTrackedItemLoaderCount } from '../../item-payload'
diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/tsconfig.json b/benchmarks/memory/client/scenarios/preload-churn/solid/tsconfig.json
index 9558353c88..b12dcb7ade 100644
--- a/benchmarks/memory/client/scenarios/preload-churn/solid/tsconfig.json
+++ b/benchmarks/memory/client/scenarios/preload-churn/solid/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"jsx": "preserve",
"allowImportingTsExtensions": true,
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/vite.config.ts b/benchmarks/memory/client/scenarios/preload-churn/solid/vite.config.ts
index 6fc5fa6c4e..efc75d2b93 100644
--- a/benchmarks/memory/client/scenarios/preload-churn/solid/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/preload-churn/solid/vite.config.ts
@@ -1,7 +1,8 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -13,7 +14,7 @@ export default defineConfig({
plugins: [
!!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&
codspeedPlugin(),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -26,9 +27,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client preload-churn (solid)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/preload-churn/vue/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/preload-churn/vue/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/preload-churn/vue/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/src/routes/items.$id.tsx b/benchmarks/memory/client/scenarios/preload-churn/vue/src/routes/items.$id.tsx
index 2a29245926..08254e173e 100644
--- a/benchmarks/memory/client/scenarios/preload-churn/vue/src/routes/items.$id.tsx
+++ b/benchmarks/memory/client/scenarios/preload-churn/vue/src/routes/items.$id.tsx
@@ -1,6 +1,19 @@
+import { defineComponent } from 'vue'
import { createFileRoute } from '@tanstack/vue-router'
import { createItemPayload, trackItemLoaderCall } from '../../../item-payload'
+const ItemComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => (
+
+ {`${data.value.id}:${data.value.byteLength}`}
+
+ )
+ },
+})
+
export const Route = createFileRoute('/items/$id')({
loader: ({ params }: { params: { id: string } }) => {
trackItemLoaderCall(params.id)
@@ -8,13 +21,3 @@ export const Route = createFileRoute('/items/$id')({
},
component: ItemComponent,
})
-
-function ItemComponent() {
- const data = Route.useLoaderData()
-
- return (
-
- {`${data.value.id}:${data.value.byteLength}`}
-
- )
-}
diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/vite.config.ts b/benchmarks/memory/client/scenarios/preload-churn/vue/vite.config.ts
index ea7ed7b695..3d56089ba7 100644
--- a/benchmarks/memory/client/scenarios/preload-churn/vue/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/preload-churn/vue/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -28,9 +29,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client preload-churn (vue)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/react/memory.bench.ts b/benchmarks/memory/client/scenarios/unique-location-churn/react/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/unique-location-churn/react/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/unique-location-churn/react/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/react/vite.config.ts b/benchmarks/memory/client/scenarios/unique-location-churn/react/vite.config.ts
index f424c57cef..7ee67bfe30 100644
--- a/benchmarks/memory/client/scenarios/unique-location-churn/react/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/unique-location-churn/react/vite.config.ts
@@ -2,6 +2,7 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import react from '@vitejs/plugin-react'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -26,9 +27,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client unique-location-churn (react)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/unique-location-churn/solid/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/unique-location-churn/solid/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/app.tsx b/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/app.tsx
index 5917ef0191..16000c90a1 100644
--- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/app.tsx
+++ b/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/app.tsx
@@ -1,5 +1,5 @@
import { RouterProvider } from '@tanstack/solid-router'
-import { render } from '@solidjs/web'
+import { render } from 'solid-js/web'
import { getRouter } from './router'
export function mountTestApp(container: Element) {
diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/solid/tsconfig.json b/benchmarks/memory/client/scenarios/unique-location-churn/solid/tsconfig.json
index 9558353c88..b12dcb7ade 100644
--- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/tsconfig.json
+++ b/benchmarks/memory/client/scenarios/unique-location-churn/solid/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"jsx": "preserve",
"allowImportingTsExtensions": true,
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/solid/vite.config.ts b/benchmarks/memory/client/scenarios/unique-location-churn/solid/vite.config.ts
index df652ab2c4..4db90da2d2 100644
--- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/unique-location-churn/solid/vite.config.ts
@@ -1,7 +1,8 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -13,7 +14,7 @@ export default defineConfig({
plugins: [
!!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&
codspeedPlugin(),
- solid({ refresh: false, dev: false }),
+ solid({ hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -26,9 +27,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client unique-location-churn (solid)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/unique-location-churn/vue/memory.bench.ts
index e645ab38f1..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/unique-location-churn/vue/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeAll(workload.before)
- afterAll(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/routes/items.$id.tsx b/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/routes/items.$id.tsx
index 1854367142..e796ee14d1 100644
--- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/routes/items.$id.tsx
+++ b/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/routes/items.$id.tsx
@@ -1,9 +1,22 @@
+import { defineComponent } from 'vue'
import { createFileRoute } from '@tanstack/vue-router'
type ItemSearch = {
q: string
}
+const ItemComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => (
+ {`${data.value.id}:${data.value.q}:${data.value.checksum}`}
+ )
+ },
+})
+
export const Route = createFileRoute('/items/$id')({
validateSearch: (search: Record): ItemSearch => ({
q: typeof search.q === 'string' ? search.q : '',
@@ -22,13 +35,3 @@ export const Route = createFileRoute('/items/$id')({
}),
component: ItemComponent,
})
-
-function ItemComponent() {
- const data = Route.useLoaderData()
-
- return (
- {`${data.value.id}:${data.value.q}:${data.value.checksum}`}
- )
-}
diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/vue/vite.config.ts b/benchmarks/memory/client/scenarios/unique-location-churn/vue/vite.config.ts
index 423126019b..d074d571b9 100644
--- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/vite.config.ts
+++ b/benchmarks/memory/client/scenarios/unique-location-churn/vue/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -28,9 +29,9 @@ export default defineConfig({
},
},
test: {
+ ...memoryConfig('client'),
name: '@benchmarks/memory-client unique-location-churn (vue)',
watch: false,
environment: 'jsdom',
- setupFiles: ['../../../vitest.setup.ts'],
},
})
diff --git a/benchmarks/memory/client/tsconfig.json b/benchmarks/memory/client/tsconfig.json
index 9280d5c42f..eefc5c581e 100644
--- a/benchmarks/memory/client/tsconfig.json
+++ b/benchmarks/memory/client/tsconfig.json
@@ -3,5 +3,10 @@
"compilerOptions": {
"types": ["node", "vite/client", "vitest/globals"]
},
- "include": ["bench-utils.ts", "lifecycle.ts", "vitest.setup.ts"]
+ "include": [
+ "bench-utils.ts",
+ "lifecycle.ts",
+ "vitest.setup.ts",
+ "scenarios/*/shared.ts"
+ ]
}
diff --git a/benchmarks/memory/runtime.ts b/benchmarks/memory/runtime.ts
new file mode 100644
index 0000000000..010149b4df
--- /dev/null
+++ b/benchmarks/memory/runtime.ts
@@ -0,0 +1,36 @@
+import { fileURLToPath } from 'node:url'
+import { isMemoryInstrumented } from './turn'
+
+/** Worker settings for the CodSpeed memory instrument. */
+export function memoryExecArgv() {
+ if (!isMemoryInstrumented()) {
+ return []
+ }
+
+ // CodSpeed supplies --no-opt, which only disables TurboFan on Node 24.
+ // Under --predictable, Maglev compilations run synchronously inside the
+ // request that triggers them, and the forced GC before the measured call can
+ // discard optimized code so recompiles land in the measured window. Their
+ // malloc'd Zone scratch (32 KiB segments) then dominates allocation metrics
+ // and depends on per-process feedback state.
+ // Limit variation from GC scheduling and bytecode reclamation; keep a
+ // fixed initial old-generation budget.
+ return [
+ '--no-maglev',
+ '--no-flush-bytecode',
+ '--no-minor-gc-task',
+ '--no-incremental-marking',
+ '--initial-old-space-size=512',
+ ]
+}
+
+export function memoryConfig(side: 'client' | 'server') {
+ const execArgv = memoryExecArgv()
+ return {
+ execArgv,
+ setupFiles:
+ side === 'client'
+ ? [fileURLToPath(new URL('./client/vitest.setup.ts', import.meta.url))]
+ : [],
+ }
+}
diff --git a/benchmarks/memory/server/bench-utils.ts b/benchmarks/memory/server/bench-utils.ts
index b8a09fdd8e..9caaf63384 100644
--- a/benchmarks/memory/server/bench-utils.ts
+++ b/benchmarks/memory/server/bench-utils.ts
@@ -1,3 +1,5 @@
+export { memoryBenchHooks } from '../turn'
+
export interface StartRequestHandler {
fetch: (request: Request) => Promise | Response
}
@@ -17,24 +19,6 @@ export type RunSequentialRequestLoopOptions =
iterations?: number
buildRequest: (random: () => number, index: number) => Request
validateResponse?: (response: Response, request: Request) => void
- // Whether V8 collects iteration i's garbage before iteration i+1
- // allocates its payload is not reproducible run to run — the measured
- // peak flips by a whole payload depending on GC timing, which shifts
- // with runner hardware. Forcing a collection between iterations pins
- // the GC points so peak deterministically measures the largest
- // single-iteration footprint plus any reachable accumulation.
- // Accumulation signals stay visible: leaked or cached objects are
- // still referenced, so a forced collection cannot reclaim them — it
- // only removes floating garbage, whose collection timing is the
- // dominant cross-run noise source.
- pinGcBetweenIterations?: boolean
- // For peak-shape scenarios ONLY (flat inter-iteration heap floor):
- // verify each pinned collection actually returned the heap to the
- // floor, extending the barrier when a runner's late teardown holds the
- // payload past the fixed window. Churn/abort scenarios must not set
- // this: their floor legitimately drifts, so the verification caps out
- // chronically and the extra collections it fires destabilize the peak.
- verifyGcFloor?: boolean
}
export const memoryBenchOptions = {
@@ -66,7 +50,7 @@ export async function drainResponse(response: Response) {
}
try {
- while (true) {
+ for (;;) {
const result = await reader.read()
if (result.done) {
@@ -82,13 +66,7 @@ export async function runSequentialRequestLoop(
handler: StartRequestHandler,
options: RunSequentialRequestLoopOptions,
) {
- const {
- iterations = 10,
- buildRequest,
- validateResponse,
- pinGcBetweenIterations = false,
- verifyGcFloor = false,
- } = options
+ const { iterations = 10, buildRequest, validateResponse } = options
const random =
options.seed !== undefined
? createDeterministicRandom(options.seed)
@@ -103,8 +81,6 @@ export async function runSequentialRequestLoop(
}
})
- const gcPinState = verifyGcFloor ? createGcPinState() : undefined
-
for (let index = 0; index < iterations; index++) {
const request = buildRequest(random, index)
const response = await handler.fetch(request)
@@ -112,89 +88,12 @@ export async function runSequentialRequestLoop(
validate(response, request)
await drainResponse(response)
-
- if (pinGcBetweenIterations) {
- await settleAndPinGc(gcPinState)
- }
}
}
-// Renderer/stream teardown spans several event-loop turns (React and Vue
-// need more than the two turns the original barrier allowed for), and a
-// too-short settle window leaks a whole payload of garbage past the
-// collection point, flipping the measured peak bimodally between runs.
-// The settle length is a fixed count on purpose: an adaptive exit (collect
-// until the post-GC heap size stops moving) makes the collection points
-// land at data-dependent turns, which re-introduces exactly the run-to-run
-// variance this barrier exists to remove — heap-size readings never fully
-// stabilize under the instrumented CI environment, so the exit point (and
-// with it every subsequent GC point) shifted between identical runs.
-const settleTurnsBeforeGc = 16
-const maxSettleTurns = 64
-// Below every scenario's payload size, above normal inter-iteration jitter.
-const settledHeapSlackBytes = 256 * 1024
-
-// Tracks the smallest post-collection heap size seen in a workload run:
-// the inter-iteration floor the heap must return to before the next
-// iteration may start.
-export interface GcPinState {
- floorHeapUsed: number
-}
-
-export function createGcPinState(): GcPinState {
- return { floorHeapUsed: Infinity }
-}
-
-// Settle trailing renderer/stream teardown with a fixed number of 0ms timer
-// hops (one full event-loop turn each, microtasks flushing between hops),
-// then pin a collection point. The second collection one turn later picks
-// up whatever the first collection's finalizers released. gc() is present
-// under CodSpeed (--expose-gc); in plain smoke runs there is nothing to
-// pin, so only the settle hops run.
-//
-// The collection is then verified against the inter-iteration heap floor:
-// on some runners the response teardown holds the payload past the fixed
-// settle window (released only by a later internal timer), and that one
-// still-reachable payload survives the collection and bleeds into the next
-// iteration's measured peak. When the post-collection heap has not returned
-// to the floor, keep hopping and collecting — bounded — until the payload
-// is actually released, so the barrier self-heals in exactly the case where
-// the fixed-count barrier fails. A workload that genuinely accumulates
-// reachable memory raises the floor as it goes (the floor is the minimum
-// seen), so accumulation still measures; it only pays the turn cap.
-export async function settleAndPinGc(state?: GcPinState) {
- for (let turn = 0; turn < settleTurnsBeforeGc; turn++) {
+// Cancellation can leave deferred loaders and renderer teardown queued.
+export async function settle() {
+ for (let turn = 0; turn < 16; turn++) {
await new Promise((resolve) => setTimeout(resolve, 0))
}
-
- const gc = (globalThis as { gc?: () => void }).gc
-
- if (!gc) {
- return
- }
-
- gc()
- await new Promise((resolve) => setTimeout(resolve, 0))
- gc()
-
- if (!state) {
- return
- }
-
- let heapUsed = process.memoryUsage().heapUsed
-
- for (
- let turn = settleTurnsBeforeGc;
- turn < maxSettleTurns &&
- heapUsed > state.floorHeapUsed + settledHeapSlackBytes;
- turn++
- ) {
- await new Promise((resolve) => setTimeout(resolve, 0))
- gc()
- heapUsed = process.memoryUsage().heapUsed
- }
-
- if (heapUsed < state.floorHeapUsed) {
- state.floorHeapUsed = heapUsed
- }
}
diff --git a/benchmarks/memory/server/benchmark.ts b/benchmarks/memory/server/benchmark.ts
index 301a9f956d..9b8dc2c76f 100644
--- a/benchmarks/memory/server/benchmark.ts
+++ b/benchmarks/memory/server/benchmark.ts
@@ -1,5 +1,9 @@
export interface ServerMemoryWorkload {
name: string
+ /**
+ * Must be an `async` function: CodSpeed's Vitest 5 provider awaits only
+ * `AsyncFunction`s and otherwise measures just the synchronous part.
+ */
run: () => Promise | void
}
diff --git a/benchmarks/memory/server/package.json b/benchmarks/memory/server/package.json
index 3663b3aa1e..d09343c7b6 100644
--- a/benchmarks/memory/server/package.json
+++ b/benchmarks/memory/server/package.json
@@ -11,7 +11,6 @@
"#memory-server/flame-runner": "./flame-runner.ts"
},
"dependencies": {
- "@solidjs/web": "^2.0.0-rc.20",
"@tanstack/react-router": "workspace:*",
"@tanstack/react-start": "workspace:*",
"@tanstack/solid-router": "workspace:*",
@@ -20,20 +19,22 @@
"@tanstack/vue-start": "workspace:*",
"react": "^19.0.0",
"react-dom": "^19.0.0",
- "solid-js": "^2.0.0-rc.20",
+ "solid-js": "^1.9.10",
"vue": "^3.5.16"
},
"devDependencies": {
- "@codspeed/vitest-plugin": "^5.5.0",
+ "@codspeed/vitest-plugin": "^6.0.1",
"@datadog/pprof": "^5.13.2",
"@platformatic/flame": "^1.6.0",
- "@solidjs/vite-plugin": "^3.0.0-next.54",
"@vitejs/plugin-react": "^6.0.1",
"@vitejs/plugin-vue-jsx": "^5.1.5",
+ "@types/react": "catalog:",
"@typescript/native": "npm:typescript@^7.0.2",
+ "jsdom": "29.1.1",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14",
- "vitest": "^4.1.4"
+ "vite-plugin-solid": "^2.11.11",
+ "vitest": "catalog:"
},
"nx": {
"targets": {
@@ -207,7 +208,7 @@
"build:react"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.react.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.react.config.ts",
"cwd": "benchmarks/memory/server"
}
},
@@ -219,7 +220,7 @@
"build:solid"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.solid.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.solid.config.ts",
"cwd": "benchmarks/memory/server"
}
},
@@ -231,12 +232,12 @@
"build:vue"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.vue.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.vue.config.ts",
"cwd": "benchmarks/memory/server"
}
},
"test:types": {
- "executor": "nx:noop",
+ "executor": "nx:run-commands",
"dependsOn": [
{
"projects": [
@@ -264,6 +265,17 @@
],
"target": "test:types:ssr"
}
+ ],
+ "options": {
+ "command": "tsc -p ./tsconfig.json --noEmit",
+ "cwd": "benchmarks/memory/server"
+ },
+ "inputs": [
+ "default",
+ "^production",
+ "{workspaceRoot}/eslint.config.js",
+ "dependentTaskOutputs",
+ "{workspaceRoot}/benchmarks/memory/*.ts"
]
}
}
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/deferred-records.ts b/benchmarks/memory/server/scenarios/aborted-requests/deferred-records.ts
index 4886e3ee80..7a1cd6d254 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/deferred-records.ts
+++ b/benchmarks/memory/server/scenarios/aborted-requests/deferred-records.ts
@@ -16,3 +16,42 @@ export function makeAbortedRequestRecords(
label: `deferred-${group}-${id}-${index}`,
}))
}
+
+// Abort probes keep their deferred payload pending until the request is
+// cancelled. Timer chains can outlive cancellation and spill into the next
+// measured request; route-loader signals stop observing the request after load.
+export function makeDeferredRecords(
+ id: string,
+ group: RecordGroup,
+ signal: AbortSignal,
+): Promise> {
+ return new Promise((resolve) => {
+ if (signal.aborted) {
+ resolve([])
+ return
+ }
+
+ let timeoutId: ReturnType | undefined
+ const onAbort = () => {
+ clearTimeout(timeoutId)
+ resolve([])
+ }
+ signal.addEventListener('abort', onAbort, { once: true })
+
+ if (id === 'sanity-mid-stream' || id.startsWith('abort-')) {
+ return
+ }
+
+ let remaining = group === 'alpha' ? 4 : 6
+ const step = () => {
+ remaining -= 1
+ if (remaining === 0) {
+ signal.removeEventListener('abort', onAbort)
+ resolve(makeAbortedRequestRecords(id, group))
+ return
+ }
+ timeoutId = setTimeout(step, 0)
+ }
+ timeoutId = setTimeout(step, 0)
+ })
+}
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/react/memory.bench.ts b/benchmarks/memory/server/scenarios/aborted-requests/react/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/react/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/aborted-requests/react/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/react/vite.config.ts b/benchmarks/memory/server/scenarios/aborted-requests/react/vite.config.ts
index 2ce925e406..eff0d0e043 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/react/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/aborted-requests/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import react from '@vitejs/plugin-react'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server aborted-requests (react)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/shared.ts b/benchmarks/memory/server/scenarios/aborted-requests/shared.ts
index c98f462538..29eca99e00 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/shared.ts
+++ b/benchmarks/memory/server/scenarios/aborted-requests/shared.ts
@@ -1,4 +1,4 @@
-import { settleAndPinGc } from '#memory-server/bench-utils'
+import { settle } from '#memory-server/bench-utils'
import type { StartRequestHandler } from '#memory-server/bench-utils'
export type { StartRequestHandler }
@@ -6,13 +6,6 @@ export type { StartRequestHandler }
type Framework = 'react' | 'solid' | 'vue'
type AbortedRequestReadMode = 'first-chunk' | 'shell-before-deferred'
-type AbortedRequestCancelMode = 'plain' | 'swallow-abort-error'
-
-type AbortedRequestMode = {
- readMode: AbortedRequestReadMode
- cancelMode: AbortedRequestCancelMode
-}
-
const abortedRequestIterations = 40
let abortedRequestCounter = 0
const eagerMarker = 'data-bench="aborted-requests-eager"'
@@ -24,19 +17,10 @@ const betaFirstRecord = (id: string) => `deferred-beta-${id}-0`
const betaLastRecord = (id: string) => `deferred-beta-${id}-19`
const textDecoder = new TextDecoder()
-const abortedRequestModes: Record = {
- react: {
- readMode: 'first-chunk',
- cancelMode: 'swallow-abort-error',
- },
- solid: {
- readMode: 'first-chunk',
- cancelMode: 'swallow-abort-error',
- },
- vue: {
- readMode: 'shell-before-deferred',
- cancelMode: 'swallow-abort-error',
- },
+const abortedRequestModes: Record = {
+ react: 'first-chunk',
+ solid: 'first-chunk',
+ vue: 'shell-before-deferred',
}
const documentRequestInit = {
@@ -96,7 +80,7 @@ async function readShellBeforeDeferred(
const reader = response.body.getReader()
let text = ''
- while (true) {
+ for (;;) {
const result = await reader.read()
const value = result.value
@@ -137,10 +121,10 @@ async function readShellBeforeDeferred(
async function readSanityStream(
response: Response,
request: Request,
- mode: AbortedRequestMode,
+ mode: AbortedRequestReadMode,
id: string,
) {
- if (mode.readMode === 'shell-before-deferred') {
+ if (mode === 'shell-before-deferred') {
return readShellBeforeDeferred(response, request, id)
}
@@ -165,36 +149,19 @@ function readLoopStream(
return readFirstChunk(response, request)
}
-async function cancelReader(
- reader: ReadableStreamDefaultReader,
- mode: AbortedRequestCancelMode,
-) {
- if (mode === 'swallow-abort-error') {
- try {
- await reader.cancel()
- } catch (error) {
- if (!(error instanceof DOMException && error.name === 'AbortError')) {
- throw error
- }
+async function cancelReader(reader: ReadableStreamDefaultReader) {
+ try {
+ await reader.cancel()
+ } catch (error) {
+ if (!(error instanceof DOMException && error.name === 'AbortError')) {
+ throw error
}
-
- return
}
-
- await reader.cancel()
-}
-
-// Post-abort settlement barrier. Settles renderer teardown across a fixed
-// number of event-loop turns, then (under CodSpeed) pins a collection point
-// after every aborted request, so the measured peak cannot drift with how
-// much floating garbage the previous iterations happened to leave behind.
-async function drainCancellation() {
- await settleAndPinGc()
}
async function assertAbortedRequestsSanity(
handler: StartRequestHandler,
- mode: AbortedRequestMode,
+ mode: AbortedRequestReadMode,
) {
const fullId = 'sanity-full'
const fullRequest = buildStreamRequest(fullId)
@@ -227,13 +194,13 @@ async function assertAbortedRequestsSanity(
// reader.cancel() is the response-stream cancellation path if the handler
// does not observe Request.signal for this in-process request.
controller.abort()
- await cancelReader(reader, mode.cancelMode)
- await drainCancellation()
+ await cancelReader(reader)
+ await settle()
}
async function runAbortedRequestLoop(
handler: StartRequestHandler,
- mode: AbortedRequestMode,
+ mode: AbortedRequestReadMode,
) {
for (let index = 0; index < abortedRequestIterations; index++) {
const controller = new AbortController()
@@ -242,15 +209,10 @@ async function runAbortedRequestLoop(
const response = await handler.fetch(request)
validateDocumentResponse(response, request)
- const { reader } = await readLoopStream(
- mode.readMode,
- response,
- request,
- id,
- )
+ const { reader } = await readLoopStream(mode, response, request, id)
controller.abort()
- await cancelReader(reader, mode.cancelMode)
- await drainCancellation()
+ await cancelReader(reader)
+ await settle()
}
}
@@ -259,7 +221,7 @@ export function createWorkloadGroup(
handler: StartRequestHandler,
) {
const mode = abortedRequestModes[framework]
- const run = () => runAbortedRequestLoop(handler, mode)
+ const run = async () => runAbortedRequestLoop(handler, mode)
return {
sanity: () => assertAbortedRequestsSanity(handler, mode),
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/aborted-requests/solid/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/solid/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/aborted-requests/solid/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/__root.tsx
index 6e83136ea0..aaf7dfdd89 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/__root.tsx
+++ b/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/__root.tsx
@@ -4,7 +4,7 @@ import {
Scripts,
createRootRoute,
} from '@tanstack/solid-router'
-import { HydrationScript } from '@solidjs/web'
+import { HydrationScript } from 'solid-js/web'
export const Route = createRootRoute({
head: () => ({
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/stream.$id.tsx b/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/stream.$id.tsx
index 0ddc6d1447..bf6af17f31 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/stream.$id.tsx
+++ b/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/stream.$id.tsx
@@ -1,90 +1,17 @@
-import { Await, createFileRoute } from '@tanstack/solid-router'
-import { Loading } from 'solid-js'
-import {
- makeAbortedRequestRecords,
- type DeferredRecord,
- type RecordGroup,
-} from '../../../deferred-records'
+import { createServerOnlyFn } from '@tanstack/solid-start'
+import { getRequest } from '@tanstack/solid-start/server'
+import { createFileRoute } from '@tanstack/solid-router'
+import { Show, Suspense, createResource } from 'solid-js'
+import { makeDeferredRecords } from '../../../deferred-records'
+import type { DeferredRecord } from '../../../deferred-records'
-const alphaResolveTicks = 4
-const betaResolveTicks = 6
-const abortProbeAlphaResolveTicks = 40
-const abortProbeBetaResolveTicks = 60
-
-function isAbortProbeId(id: string) {
- return id === 'sanity-mid-stream' || id.startsWith('abort-')
-}
-
-function getResolveTicks(id: string, group: RecordGroup) {
- if (isAbortProbeId(id)) {
- return group === 'alpha'
- ? abortProbeAlphaResolveTicks
- : abortProbeBetaResolveTicks
- }
-
- return group === 'alpha' ? alphaResolveTicks : betaResolveTicks
-}
-
-// One tick = one 0ms timers-phase hop. Counting event-loop turns instead of
-// milliseconds keeps the resolve/abort interleaving a pure function of the
-// event-loop schedule: a wall-clock delay races the abort differently
-// depending on runner load and instrumentation overhead, which made this
-// benchmark's single measured run swing between runs.
-function resolveAfterTicks(
- ticks: number,
- signal: AbortSignal,
- value: () => T,
- abortedValue: () => T,
-) {
- return new Promise((resolve) => {
- if (signal.aborted) {
- resolve(abortedValue())
- return
- }
-
- let remaining = ticks
- let timeoutId: ReturnType
-
- const onAbort = () => {
- clearTimeout(timeoutId)
- resolve(abortedValue())
- }
-
- const step = () => {
- remaining -= 1
-
- if (remaining <= 0) {
- signal.removeEventListener('abort', onAbort)
- resolve(value())
- return
- }
-
- timeoutId = setTimeout(step, 0)
- }
-
- signal.addEventListener('abort', onAbort, { once: true })
- timeoutId = setTimeout(step, 0)
- })
-}
-
-function makeDeferredRecords(
- id: string,
- group: RecordGroup,
- signal: AbortSignal,
-) {
- return resolveAfterTicks(
- getResolveTicks(id, group),
- signal,
- () => makeAbortedRequestRecords(id, group),
- () => [],
- )
-}
+const getRequestSignal = createServerOnlyFn(() => getRequest().signal)
export const Route = createFileRoute('/stream/$id')({
- loader: ({ params, abortController }) => ({
+ loader: ({ params }) => ({
eager: `eager-${params.id}`,
- alpha: makeDeferredRecords(params.id, 'alpha', abortController.signal),
- beta: makeDeferredRecords(params.id, 'beta', abortController.signal),
+ alpha: makeDeferredRecords(params.id, 'alpha', getRequestSignal()),
+ beta: makeDeferredRecords(params.id, 'beta', getRequestSignal()),
}),
component: StreamComponent,
})
@@ -95,47 +22,48 @@ function StreamComponent() {
return (
{data().eager}
- loading-alpha
}
>
-
- {(records) => (
-
- )}
-
-
-
+
+ loading-beta
}
>
-
- {(records) => (
-
- )}
-
-
+
+
)
}
function DeferredRecords(props: {
- records: Array
+ promise: Promise>
dataBench: string
}) {
+ const [records] = createResource(
+ () => props.promise,
+ (promise) => promise,
+ )
+
return (
-
- {props.records.map((record) => (
- {record.label}
- ))}
-
+
+ {(resolvedRecords) => (
+
+ {resolvedRecords().map((record) => (
+ {record.label}
+ ))}
+
+ )}
+
)
}
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/tsconfig.json b/benchmarks/memory/server/scenarios/aborted-requests/solid/tsconfig.json
index cdb88448d7..4b61264e11 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/solid/tsconfig.json
+++ b/benchmarks/memory/server/scenarios/aborted-requests/solid/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"allowImportingTsExtensions": true,
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/vite.config.ts b/benchmarks/memory/server/scenarios/aborted-requests/solid/vite.config.ts
index 6b39cd33c3..d7fd3459ee 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/solid/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/aborted-requests/solid/vite.config.ts
@@ -2,7 +2,8 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/solid-start/plugin/vite'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -14,7 +15,7 @@ export default defineConfig({
tanstackStart({
srcDirectory: 'src',
}),
- solid({ ssr: true, refresh: false, dev: false }),
+ solid({ ssr: true, hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server aborted-requests (solid)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/aborted-requests/vue/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/vue/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/aborted-requests/vue/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routes/stream.$id.tsx b/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routes/stream.$id.tsx
index b723c7f69e..e41af03c16 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routes/stream.$id.tsx
+++ b/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routes/stream.$id.tsx
@@ -1,136 +1,65 @@
+import { createServerOnlyFn } from '@tanstack/vue-start'
+import { getRequest } from '@tanstack/vue-start/server'
import { Await, createFileRoute } from '@tanstack/vue-router'
-import { Suspense } from 'vue'
-import {
- makeAbortedRequestRecords,
- type DeferredRecord,
- type RecordGroup,
-} from '../../../deferred-records'
+import { Suspense, defineComponent } from 'vue'
+import { makeDeferredRecords } from '../../../deferred-records'
+import type { DeferredRecord } from '../../../deferred-records'
-const alphaResolveTicks = 4
-const betaResolveTicks = 6
-const abortProbeAlphaResolveTicks = 40
-const abortProbeBetaResolveTicks = 60
+const getRequestSignal = createServerOnlyFn(() => getRequest().signal)
-function isAbortProbeId(id: string) {
- return id === 'sanity-mid-stream' || id.startsWith('abort-')
-}
+const StreamComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
-function getResolveTicks(id: string, group: RecordGroup) {
- if (isAbortProbeId(id)) {
- return group === 'alpha'
- ? abortProbeAlphaResolveTicks
- : abortProbeBetaResolveTicks
- }
-
- return group === 'alpha' ? alphaResolveTicks : betaResolveTicks
-}
-
-// One tick = one 0ms timers-phase hop. Counting event-loop turns instead of
-// milliseconds keeps the resolve/abort interleaving a pure function of the
-// event-loop schedule: a wall-clock delay races the abort differently
-// depending on runner load and instrumentation overhead, which made this
-// benchmark's single measured run swing between runs.
-function resolveAfterTicks(
- ticks: number,
- signal: AbortSignal,
- value: () => T,
- abortedValue: () => T,
-) {
- return new Promise((resolve) => {
- if (signal.aborted) {
- resolve(abortedValue())
- return
- }
-
- let remaining = ticks
- let timeoutId: ReturnType
-
- const onAbort = () => {
- clearTimeout(timeoutId)
- resolve(abortedValue())
- }
-
- const step = () => {
- remaining -= 1
-
- if (remaining <= 0) {
- signal.removeEventListener('abort', onAbort)
- resolve(value())
- return
- }
-
- timeoutId = setTimeout(step, 0)
- }
-
- signal.addEventListener('abort', onAbort, { once: true })
- timeoutId = setTimeout(step, 0)
- })
-}
-
-function makeDeferredRecords(
- id: string,
- group: RecordGroup,
- signal: AbortSignal,
-) {
- return resolveAfterTicks(
- getResolveTicks(id, group),
- signal,
- () => makeAbortedRequestRecords(id, group),
- () => [],
- )
-}
+ return () => (
+
+ {data.value.eager}
+ loading-alpha
+ loading-beta
+
+ {{
+ default: () => (
+ ) => (
+
+ {records.map((record) => (
+ {record.label}
+ ))}
+
+ )}
+ />
+ ),
+ fallback: () => null,
+ }}
+
+
+ {{
+ default: () => (
+ ) => (
+
+ {records.map((record) => (
+ {record.label}
+ ))}
+
+ )}
+ />
+ ),
+ fallback: () => null,
+ }}
+
+
+ )
+ },
+})
export const Route = createFileRoute('/stream/$id')({
- loader: ({ params, abortController }) => ({
+ loader: ({ params }) => ({
eager: `eager-${params.id}`,
- alpha: makeDeferredRecords(params.id, 'alpha', abortController.signal),
- beta: makeDeferredRecords(params.id, 'beta', abortController.signal),
+ alpha: makeDeferredRecords(params.id, 'alpha', getRequestSignal()),
+ beta: makeDeferredRecords(params.id, 'beta', getRequestSignal()),
}),
component: StreamComponent,
})
-
-function StreamComponent() {
- const data = Route.useLoaderData()
-
- return (
-
- {data.value.eager}
- loading-alpha
- loading-beta
-
- {{
- default: () => (
- ) => (
-
- {records.map((record) => (
- {record.label}
- ))}
-
- )}
- />
- ),
- fallback: () => null,
- }}
-
-
- {{
- default: () => (
- ) => (
-
- {records.map((record) => (
- {record.label}
- ))}
-
- )}
- />
- ),
- fallback: () => null,
- }}
-
-
- )
-}
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/vite.config.ts b/benchmarks/memory/server/scenarios/aborted-requests/vue/vite.config.ts
index 5ccc9f5d1d..e4e1eb66d4 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/vue/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/aborted-requests/vue/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/vue-start/plugin/vite'
import vueJsx from '@vitejs/plugin-vue-jsx'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server aborted-requests (vue)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/error-paths/react/memory.bench.ts b/benchmarks/memory/server/scenarios/error-paths/react/memory.bench.ts
index 9a5c211fee..a6f07b97be 100644
--- a/benchmarks/memory/server/scenarios/error-paths/react/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/react/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
- for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
- }
+const workload = workloadGroup.workloads[0]!
+
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/react/memory.error.bench.ts b/benchmarks/memory/server/scenarios/error-paths/react/memory.error.bench.ts
new file mode 100644
index 0000000000..89071137c3
--- /dev/null
+++ b/benchmarks/memory/server/scenarios/error-paths/react/memory.error.bench.ts
@@ -0,0 +1,16 @@
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
+import { workloadGroup } from './setup'
+
+await workloadGroup.sanity()
+
+const workload = workloadGroup.workloads[2]!
+
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
+})
diff --git a/benchmarks/memory/server/scenarios/error-paths/react/memory.not-found.bench.ts b/benchmarks/memory/server/scenarios/error-paths/react/memory.not-found.bench.ts
new file mode 100644
index 0000000000..fa6a6693ed
--- /dev/null
+++ b/benchmarks/memory/server/scenarios/error-paths/react/memory.not-found.bench.ts
@@ -0,0 +1,16 @@
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
+import { workloadGroup } from './setup'
+
+await workloadGroup.sanity()
+
+const workload = workloadGroup.workloads[1]!
+
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
+})
diff --git a/benchmarks/memory/server/scenarios/error-paths/react/memory.unmatched.bench.ts b/benchmarks/memory/server/scenarios/error-paths/react/memory.unmatched.bench.ts
new file mode 100644
index 0000000000..b2c3d24200
--- /dev/null
+++ b/benchmarks/memory/server/scenarios/error-paths/react/memory.unmatched.bench.ts
@@ -0,0 +1,16 @@
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
+import { workloadGroup } from './setup'
+
+await workloadGroup.sanity()
+
+const workload = workloadGroup.workloads[3]!
+
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
+})
diff --git a/benchmarks/memory/server/scenarios/error-paths/react/tsconfig.json b/benchmarks/memory/server/scenarios/error-paths/react/tsconfig.json
index 11ddcce4ea..2dba47fc99 100644
--- a/benchmarks/memory/server/scenarios/error-paths/react/tsconfig.json
+++ b/benchmarks/memory/server/scenarios/error-paths/react/tsconfig.json
@@ -7,7 +7,7 @@
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
- "memory.bench.ts",
+ "memory*.bench.ts",
"memory.flame.ts",
"setup.ts",
"vite.config.ts",
diff --git a/benchmarks/memory/server/scenarios/error-paths/react/vite.config.ts b/benchmarks/memory/server/scenarios/error-paths/react/vite.config.ts
index bc67b1cfc7..c00de7727a 100644
--- a/benchmarks/memory/server/scenarios/error-paths/react/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import react from '@vitejs/plugin-react'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -22,19 +23,8 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ isolate: true,
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server error-paths (react)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/error-paths/shared.ts b/benchmarks/memory/server/scenarios/error-paths/shared.ts
index 57e229b7e3..11ed293d22 100644
--- a/benchmarks/memory/server/scenarios/error-paths/shared.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/shared.ts
@@ -9,8 +9,6 @@ export type { StartRequestHandler }
type Framework = 'react' | 'solid' | 'vue'
-// Sized to sit just above the 2s measured-run floor on CI (per-iteration
-// cost with the pinned collection is ~0.13-0.19s across frameworks).
const errorPathsIterations = 18
const redirectSeed = 0xdecafbad
const notFoundSeed = 0xdecafb0d
@@ -138,40 +136,36 @@ export function createWorkloadGroup(
framework: Framework,
handler: StartRequestHandler,
) {
- const runRedirect = () =>
+ const runRedirect = async () =>
runSequentialRequestLoop(handler, {
random: redirectRandom,
iterations: errorPathsIterations,
buildRequest: buildRedirectRequest,
validateResponse: validateRedirectResponse,
- pinGcBetweenIterations: true,
})
- const runNotFound = () =>
+ const runNotFound = async () =>
runSequentialRequestLoop(handler, {
random: notFoundRandom,
iterations: errorPathsIterations,
buildRequest: buildNotFoundRequest,
validateResponse: validateNotFoundResponse,
- pinGcBetweenIterations: true,
})
- const runError = () =>
+ const runError = async () =>
runSequentialRequestLoop(handler, {
random: errorRandom,
iterations: errorPathsIterations,
buildRequest: buildErrorRequest,
validateResponse: validateErrorResponse,
- pinGcBetweenIterations: true,
})
- const runUnmatched = () =>
+ const runUnmatched = async () =>
runSequentialRequestLoop(handler, {
random: unmatchedRandom,
iterations: errorPathsIterations,
buildRequest: buildUnmatchedRequest,
validateResponse: validateNotFoundResponse,
- pinGcBetweenIterations: true,
})
return {
diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/error-paths/solid/memory.bench.ts
index 9a5c211fee..a6f07b97be 100644
--- a/benchmarks/memory/server/scenarios/error-paths/solid/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/solid/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
- for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
- }
+const workload = workloadGroup.workloads[0]!
+
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/memory.error.bench.ts b/benchmarks/memory/server/scenarios/error-paths/solid/memory.error.bench.ts
new file mode 100644
index 0000000000..89071137c3
--- /dev/null
+++ b/benchmarks/memory/server/scenarios/error-paths/solid/memory.error.bench.ts
@@ -0,0 +1,16 @@
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
+import { workloadGroup } from './setup'
+
+await workloadGroup.sanity()
+
+const workload = workloadGroup.workloads[2]!
+
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
+})
diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/memory.not-found.bench.ts b/benchmarks/memory/server/scenarios/error-paths/solid/memory.not-found.bench.ts
new file mode 100644
index 0000000000..fa6a6693ed
--- /dev/null
+++ b/benchmarks/memory/server/scenarios/error-paths/solid/memory.not-found.bench.ts
@@ -0,0 +1,16 @@
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
+import { workloadGroup } from './setup'
+
+await workloadGroup.sanity()
+
+const workload = workloadGroup.workloads[1]!
+
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
+})
diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/memory.unmatched.bench.ts b/benchmarks/memory/server/scenarios/error-paths/solid/memory.unmatched.bench.ts
new file mode 100644
index 0000000000..b2c3d24200
--- /dev/null
+++ b/benchmarks/memory/server/scenarios/error-paths/solid/memory.unmatched.bench.ts
@@ -0,0 +1,16 @@
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
+import { workloadGroup } from './setup'
+
+await workloadGroup.sanity()
+
+const workload = workloadGroup.workloads[3]!
+
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
+})
diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/__root.tsx
index 6e83136ea0..aaf7dfdd89 100644
--- a/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/__root.tsx
+++ b/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/__root.tsx
@@ -4,7 +4,7 @@ import {
Scripts,
createRootRoute,
} from '@tanstack/solid-router'
-import { HydrationScript } from '@solidjs/web'
+import { HydrationScript } from 'solid-js/web'
export const Route = createRootRoute({
head: () => ({
diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/tsconfig.json b/benchmarks/memory/server/scenarios/error-paths/solid/tsconfig.json
index cdb88448d7..1e8103127a 100644
--- a/benchmarks/memory/server/scenarios/error-paths/solid/tsconfig.json
+++ b/benchmarks/memory/server/scenarios/error-paths/solid/tsconfig.json
@@ -3,11 +3,11 @@
"compilerOptions": {
"allowImportingTsExtensions": true,
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
- "memory.bench.ts",
+ "memory*.bench.ts",
"memory.flame.ts",
"setup.ts",
"vite.config.ts",
diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/vite.config.ts b/benchmarks/memory/server/scenarios/error-paths/solid/vite.config.ts
index 9a3f302349..d7a0bb51b0 100644
--- a/benchmarks/memory/server/scenarios/error-paths/solid/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/solid/vite.config.ts
@@ -2,7 +2,8 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/solid-start/plugin/vite'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -14,7 +15,7 @@ export default defineConfig({
tanstackStart({
srcDirectory: 'src',
}),
- solid({ ssr: true, refresh: false, dev: false }),
+ solid({ ssr: true, hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -22,19 +23,8 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ isolate: true,
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server error-paths (solid)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/error-paths/vue/memory.bench.ts
index 9a5c211fee..a6f07b97be 100644
--- a/benchmarks/memory/server/scenarios/error-paths/vue/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/vue/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
- for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
- }
+const workload = workloadGroup.workloads[0]!
+
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/memory.error.bench.ts b/benchmarks/memory/server/scenarios/error-paths/vue/memory.error.bench.ts
new file mode 100644
index 0000000000..89071137c3
--- /dev/null
+++ b/benchmarks/memory/server/scenarios/error-paths/vue/memory.error.bench.ts
@@ -0,0 +1,16 @@
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
+import { workloadGroup } from './setup'
+
+await workloadGroup.sanity()
+
+const workload = workloadGroup.workloads[2]!
+
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
+})
diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/memory.not-found.bench.ts b/benchmarks/memory/server/scenarios/error-paths/vue/memory.not-found.bench.ts
new file mode 100644
index 0000000000..fa6a6693ed
--- /dev/null
+++ b/benchmarks/memory/server/scenarios/error-paths/vue/memory.not-found.bench.ts
@@ -0,0 +1,16 @@
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
+import { workloadGroup } from './setup'
+
+await workloadGroup.sanity()
+
+const workload = workloadGroup.workloads[1]!
+
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
+})
diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/memory.unmatched.bench.ts b/benchmarks/memory/server/scenarios/error-paths/vue/memory.unmatched.bench.ts
new file mode 100644
index 0000000000..b2c3d24200
--- /dev/null
+++ b/benchmarks/memory/server/scenarios/error-paths/vue/memory.unmatched.bench.ts
@@ -0,0 +1,16 @@
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
+import { workloadGroup } from './setup'
+
+await workloadGroup.sanity()
+
+const workload = workloadGroup.workloads[3]!
+
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
+})
diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/target.$id.tsx b/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/target.$id.tsx
index 17ade6bf5b..0bbf4a3dc6 100644
--- a/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/target.$id.tsx
+++ b/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/target.$id.tsx
@@ -1,11 +1,14 @@
+import { defineComponent } from 'vue'
import { createFileRoute } from '@tanstack/vue-router'
+const TargetComponent = defineComponent({
+ setup() {
+ const params = Route.useParams()
+
+ return () => {`target-${params.value.id}`}
+ },
+})
+
export const Route = createFileRoute('/target/$id')({
component: TargetComponent,
})
-
-function TargetComponent() {
- const params = Route.useParams()
-
- return {`target-${params.value.id}`}
-}
diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/tsconfig.json b/benchmarks/memory/server/scenarios/error-paths/vue/tsconfig.json
index 9ad6481342..af8b83005c 100644
--- a/benchmarks/memory/server/scenarios/error-paths/vue/tsconfig.json
+++ b/benchmarks/memory/server/scenarios/error-paths/vue/tsconfig.json
@@ -7,7 +7,7 @@
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
- "memory.bench.ts",
+ "memory*.bench.ts",
"memory.flame.ts",
"setup.ts",
"vite.config.ts",
diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/vite.config.ts b/benchmarks/memory/server/scenarios/error-paths/vue/vite.config.ts
index 9a0ca28a25..3dc0762aa0 100644
--- a/benchmarks/memory/server/scenarios/error-paths/vue/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/vue/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/vue-start/plugin/vite'
import vueJsx from '@vitejs/plugin-vue-jsx'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -22,19 +23,8 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ isolate: true,
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server error-paths (vue)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/memory.bench.ts b/benchmarks/memory/server/scenarios/peak-large-page/react/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/react/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/peak-large-page/react/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/vite.config.ts b/benchmarks/memory/server/scenarios/peak-large-page/react/vite.config.ts
index adaacda86e..dcfcf1f92b 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/react/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/peak-large-page/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import react from '@vitejs/plugin-react'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server peak-large-page (react)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/shared.ts b/benchmarks/memory/server/scenarios/peak-large-page/shared.ts
index 578fc9c5a2..085e576244 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/shared.ts
+++ b/benchmarks/memory/server/scenarios/peak-large-page/shared.ts
@@ -6,7 +6,7 @@ export type { StartRequestHandler }
type Framework = 'react' | 'solid' | 'vue'
const benchmarkSeed = 0x5eed_0005
-const peakLargePageIterations = 20
+const peakLargePageIterations = 1
const peakLargePageUrl = 'http://localhost/l1/l2/l3/l4/l5/l6/l7/l8'
const levelEightMarker = 'data-bench="peak-large-page-level-8"'
@@ -48,14 +48,12 @@ export function createWorkloadGroup(
framework: Framework,
handler: StartRequestHandler,
) {
- const run = () =>
+ const run = async () =>
runSequentialRequestLoop(handler, {
seed: benchmarkSeed,
iterations: peakLargePageIterations,
buildRequest: buildPeakLargePageRequest,
validateResponse: validatePeakLargePageResponse,
- pinGcBetweenIterations: true,
- verifyGcFloor: true,
})
return {
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/peak-large-page/solid/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/solid/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/peak-large-page/solid/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/__root.tsx
index 6e83136ea0..aaf7dfdd89 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/__root.tsx
+++ b/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/__root.tsx
@@ -4,7 +4,7 @@ import {
Scripts,
createRootRoute,
} from '@tanstack/solid-router'
-import { HydrationScript } from '@solidjs/web'
+import { HydrationScript } from 'solid-js/web'
export const Route = createRootRoute({
head: () => ({
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/tsconfig.json b/benchmarks/memory/server/scenarios/peak-large-page/solid/tsconfig.json
index cdb88448d7..4b61264e11 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/solid/tsconfig.json
+++ b/benchmarks/memory/server/scenarios/peak-large-page/solid/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"allowImportingTsExtensions": true,
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/vite.config.ts b/benchmarks/memory/server/scenarios/peak-large-page/solid/vite.config.ts
index 5e906a464b..15b8c3a571 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/solid/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/peak-large-page/solid/vite.config.ts
@@ -2,7 +2,8 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/solid-start/plugin/vite'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -14,7 +15,7 @@ export default defineConfig({
tanstackStart({
srcDirectory: 'src',
}),
- solid({ ssr: true, refresh: false, dev: false }),
+ solid({ ssr: true, hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server peak-large-page (solid)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/peak-large-page/vue/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/vue/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/peak-large-page/vue/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.l7.l8.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.l7.l8.tsx
index bd079aa1a0..7f7a42d645 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.l7.l8.tsx
+++ b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.l7.l8.tsx
@@ -1,28 +1,34 @@
+import { defineComponent } from 'vue'
import { createFileRoute } from '@tanstack/vue-router'
import {
makeLargePageHead,
makeLargePageLevelData,
} from '../../../large-page-data'
+const LevelEightComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => {
+ const first = data.value.records[0]!
+
+ return (
+
+ {data.value.marker}
+ records: {data.value.records.length}
+
+ {first.name}
+ {first.id}
+ {first.description}
+
+
+ )
+ }
+ },
+})
+
export const Route = createFileRoute('/l1/l2/l3/l4/l5/l6/l7/l8')({
loader: () => makeLargePageLevelData(8, 0x5eed_1008),
head: ({ loaderData }) => makeLargePageHead(loaderData),
component: LevelEightComponent,
})
-
-function LevelEightComponent() {
- const data = Route.useLoaderData()
- const first = data.value.records[0]!
-
- return (
-
- {data.value.marker}
- records: {data.value.records.length}
-
- {first.name}
- {first.id}
- {first.description}
-
-
- )
-}
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.l7.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.l7.tsx
index 7f69f6f438..a99c56e529 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.l7.tsx
+++ b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.l7.tsx
@@ -1,29 +1,35 @@
+import { defineComponent } from 'vue'
import { Outlet, createFileRoute } from '@tanstack/vue-router'
import {
makeLargePageHead,
makeLargePageLevelData,
} from '../../../large-page-data'
+const LevelSevenComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => {
+ const first = data.value.records[0]!
+
+ return (
+
+ {data.value.marker}
+ records: {data.value.records.length}
+
+ {first.name}
+ {first.id}
+ {first.description}
+
+
+
+ )
+ }
+ },
+})
+
export const Route = createFileRoute('/l1/l2/l3/l4/l5/l6/l7')({
loader: () => makeLargePageLevelData(7, 0x5eed_1007),
head: ({ loaderData }) => makeLargePageHead(loaderData),
component: LevelSevenComponent,
})
-
-function LevelSevenComponent() {
- const data = Route.useLoaderData()
- const first = data.value.records[0]!
-
- return (
-
- {data.value.marker}
- records: {data.value.records.length}
-
- {first.name}
- {first.id}
- {first.description}
-
-
-
- )
-}
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.tsx
index 75a7c717e3..3de3f03427 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.tsx
+++ b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.tsx
@@ -1,29 +1,35 @@
+import { defineComponent } from 'vue'
import { Outlet, createFileRoute } from '@tanstack/vue-router'
import {
makeLargePageHead,
makeLargePageLevelData,
} from '../../../large-page-data'
+const LevelSixComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => {
+ const first = data.value.records[0]!
+
+ return (
+
+ {data.value.marker}
+ records: {data.value.records.length}
+
+ {first.name}
+ {first.id}
+ {first.description}
+
+
+
+ )
+ }
+ },
+})
+
export const Route = createFileRoute('/l1/l2/l3/l4/l5/l6')({
loader: () => makeLargePageLevelData(6, 0x5eed_1006),
head: ({ loaderData }) => makeLargePageHead(loaderData),
component: LevelSixComponent,
})
-
-function LevelSixComponent() {
- const data = Route.useLoaderData()
- const first = data.value.records[0]!
-
- return (
-
- {data.value.marker}
- records: {data.value.records.length}
-
- {first.name}
- {first.id}
- {first.description}
-
-
-
- )
-}
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.tsx
index f390ae3db3..5d936f83b5 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.tsx
+++ b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.tsx
@@ -1,29 +1,35 @@
+import { defineComponent } from 'vue'
import { Outlet, createFileRoute } from '@tanstack/vue-router'
import {
makeLargePageHead,
makeLargePageLevelData,
} from '../../../large-page-data'
+const LevelFiveComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => {
+ const first = data.value.records[0]!
+
+ return (
+
+ {data.value.marker}
+ records: {data.value.records.length}
+
+ {first.name}
+ {first.id}
+ {first.description}
+
+
+
+ )
+ }
+ },
+})
+
export const Route = createFileRoute('/l1/l2/l3/l4/l5')({
loader: () => makeLargePageLevelData(5, 0x5eed_1005),
head: ({ loaderData }) => makeLargePageHead(loaderData),
component: LevelFiveComponent,
})
-
-function LevelFiveComponent() {
- const data = Route.useLoaderData()
- const first = data.value.records[0]!
-
- return (
-
- {data.value.marker}
- records: {data.value.records.length}
-
- {first.name}
- {first.id}
- {first.description}
-
-
-
- )
-}
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.tsx
index 6b30bd50dc..8e10331f2d 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.tsx
+++ b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.tsx
@@ -1,29 +1,35 @@
+import { defineComponent } from 'vue'
import { Outlet, createFileRoute } from '@tanstack/vue-router'
import {
makeLargePageHead,
makeLargePageLevelData,
} from '../../../large-page-data'
+const LevelFourComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => {
+ const first = data.value.records[0]!
+
+ return (
+
+ {data.value.marker}
+ records: {data.value.records.length}
+
+ {first.name}
+ {first.id}
+ {first.description}
+
+
+
+ )
+ }
+ },
+})
+
export const Route = createFileRoute('/l1/l2/l3/l4')({
loader: () => makeLargePageLevelData(4, 0x5eed_1004),
head: ({ loaderData }) => makeLargePageHead(loaderData),
component: LevelFourComponent,
})
-
-function LevelFourComponent() {
- const data = Route.useLoaderData()
- const first = data.value.records[0]!
-
- return (
-
- {data.value.marker}
- records: {data.value.records.length}
-
- {first.name}
- {first.id}
- {first.description}
-
-
-
- )
-}
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.tsx
index 6ec6f32fea..d69529c50c 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.tsx
+++ b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.tsx
@@ -1,29 +1,35 @@
+import { defineComponent } from 'vue'
import { Outlet, createFileRoute } from '@tanstack/vue-router'
import {
makeLargePageHead,
makeLargePageLevelData,
} from '../../../large-page-data'
+const LevelThreeComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => {
+ const first = data.value.records[0]!
+
+ return (
+
+ {data.value.marker}
+ records: {data.value.records.length}
+
+ {first.name}
+ {first.id}
+ {first.description}
+
+
+
+ )
+ }
+ },
+})
+
export const Route = createFileRoute('/l1/l2/l3')({
loader: () => makeLargePageLevelData(3, 0x5eed_1003),
head: ({ loaderData }) => makeLargePageHead(loaderData),
component: LevelThreeComponent,
})
-
-function LevelThreeComponent() {
- const data = Route.useLoaderData()
- const first = data.value.records[0]!
-
- return (
-
- {data.value.marker}
- records: {data.value.records.length}
-
- {first.name}
- {first.id}
- {first.description}
-
-
-
- )
-}
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.tsx
index e5b4cf0de1..d04bc7f827 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.tsx
+++ b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.tsx
@@ -1,29 +1,35 @@
+import { defineComponent } from 'vue'
import { Outlet, createFileRoute } from '@tanstack/vue-router'
import {
makeLargePageHead,
makeLargePageLevelData,
} from '../../../large-page-data'
+const LevelTwoComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => {
+ const first = data.value.records[0]!
+
+ return (
+
+ {data.value.marker}
+ records: {data.value.records.length}
+
+ {first.name}
+ {first.id}
+ {first.description}
+
+
+
+ )
+ }
+ },
+})
+
export const Route = createFileRoute('/l1/l2')({
loader: () => makeLargePageLevelData(2, 0x5eed_1002),
head: ({ loaderData }) => makeLargePageHead(loaderData),
component: LevelTwoComponent,
})
-
-function LevelTwoComponent() {
- const data = Route.useLoaderData()
- const first = data.value.records[0]!
-
- return (
-
- {data.value.marker}
- records: {data.value.records.length}
-
- {first.name}
- {first.id}
- {first.description}
-
-
-
- )
-}
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.tsx
index a29e465cd4..a95ae7f9b0 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.tsx
+++ b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.tsx
@@ -1,29 +1,35 @@
+import { defineComponent } from 'vue'
import { Outlet, createFileRoute } from '@tanstack/vue-router'
import {
makeLargePageHead,
makeLargePageLevelData,
} from '../../../large-page-data'
+const LevelOneComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => {
+ const first = data.value.records[0]!
+
+ return (
+
+ {data.value.marker}
+ records: {data.value.records.length}
+
+ {first.name}
+ {first.id}
+ {first.description}
+
+
+
+ )
+ }
+ },
+})
+
export const Route = createFileRoute('/l1')({
loader: () => makeLargePageLevelData(1, 0x5eed_1001),
head: ({ loaderData }) => makeLargePageHead(loaderData),
component: LevelOneComponent,
})
-
-function LevelOneComponent() {
- const data = Route.useLoaderData()
- const first = data.value.records[0]!
-
- return (
-
- {data.value.marker}
- records: {data.value.records.length}
-
- {first.name}
- {first.id}
- {first.description}
-
-
-
- )
-}
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/vite.config.ts b/benchmarks/memory/server/scenarios/peak-large-page/vue/vite.config.ts
index 0f238bd7f7..3fab2aff9e 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/vue/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/peak-large-page/vue/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/vue-start/plugin/vite'
import vueJsx from '@vitejs/plugin-vue-jsx'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server peak-large-page (vue)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/request-churn/react/memory.bench.ts b/benchmarks/memory/server/scenarios/request-churn/react/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/request-churn/react/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/request-churn/react/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/request-churn/react/vite.config.ts b/benchmarks/memory/server/scenarios/request-churn/react/vite.config.ts
index 1e956958ec..35adf6a249 100644
--- a/benchmarks/memory/server/scenarios/request-churn/react/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/request-churn/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import react from '@vitejs/plugin-react'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server request-churn (react)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/request-churn/shared.ts b/benchmarks/memory/server/scenarios/request-churn/shared.ts
index a196eec8b5..b200c96ed6 100644
--- a/benchmarks/memory/server/scenarios/request-churn/shared.ts
+++ b/benchmarks/memory/server/scenarios/request-churn/shared.ts
@@ -62,13 +62,12 @@ export function createWorkloadGroup(
return new Request(`http://localhost/items/${id}?q=${q}`, requestInit)
}
- const run = () =>
+ const run = async () =>
runSequentialRequestLoop(handler, {
random: benchmarkRandom,
iterations: requestChurnIterations,
buildRequest: buildItemRequest,
validateResponse: validateItemResponse,
- pinGcBetweenIterations: true,
})
return {
diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/request-churn/solid/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/request-churn/solid/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/request-churn/solid/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/request-churn/solid/src/routes/__root.tsx
index 6e83136ea0..aaf7dfdd89 100644
--- a/benchmarks/memory/server/scenarios/request-churn/solid/src/routes/__root.tsx
+++ b/benchmarks/memory/server/scenarios/request-churn/solid/src/routes/__root.tsx
@@ -4,7 +4,7 @@ import {
Scripts,
createRootRoute,
} from '@tanstack/solid-router'
-import { HydrationScript } from '@solidjs/web'
+import { HydrationScript } from 'solid-js/web'
export const Route = createRootRoute({
head: () => ({
diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/tsconfig.json b/benchmarks/memory/server/scenarios/request-churn/solid/tsconfig.json
index cdb88448d7..4b61264e11 100644
--- a/benchmarks/memory/server/scenarios/request-churn/solid/tsconfig.json
+++ b/benchmarks/memory/server/scenarios/request-churn/solid/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"allowImportingTsExtensions": true,
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/vite.config.ts b/benchmarks/memory/server/scenarios/request-churn/solid/vite.config.ts
index b9dffd9ec9..6601309a74 100644
--- a/benchmarks/memory/server/scenarios/request-churn/solid/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/request-churn/solid/vite.config.ts
@@ -2,7 +2,8 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/solid-start/plugin/vite'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -14,7 +15,7 @@ export default defineConfig({
tanstackStart({
srcDirectory: 'src',
}),
- solid({ ssr: true, refresh: false, dev: false }),
+ solid({ ssr: true, hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server request-churn (solid)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/request-churn/vue/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/request-churn/vue/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/request-churn/vue/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/src/routes/items.$id.tsx b/benchmarks/memory/server/scenarios/request-churn/vue/src/routes/items.$id.tsx
index a98d036565..570561f2a8 100644
--- a/benchmarks/memory/server/scenarios/request-churn/vue/src/routes/items.$id.tsx
+++ b/benchmarks/memory/server/scenarios/request-churn/vue/src/routes/items.$id.tsx
@@ -1,3 +1,4 @@
+import { defineComponent } from 'vue'
import { createFileRoute } from '@tanstack/vue-router'
const itemIndexes = Array.from({ length: 5 }, (_, index) => index)
@@ -6,6 +7,24 @@ type ItemSearch = {
q: string
}
+const ItemComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => (
+
+ {data.value.title}
+ {data.value.q}
+
+ {data.value.items.map((item) => (
+ {item.label}
+ ))}
+
+
+ )
+ },
+})
+
export const Route = createFileRoute('/items/$id')({
validateSearch: (search: Record): ItemSearch => ({
q: typeof search.q === 'string' ? search.q : '',
@@ -22,19 +41,3 @@ export const Route = createFileRoute('/items/$id')({
}),
component: ItemComponent,
})
-
-function ItemComponent() {
- const data = Route.useLoaderData()
-
- return (
-
- {data.value.title}
- {data.value.q}
-
- {data.value.items.map((item) => (
- {item.label}
- ))}
-
-
- )
-}
diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/vite.config.ts b/benchmarks/memory/server/scenarios/request-churn/vue/vite.config.ts
index a551a96e2f..7f15c5c7af 100644
--- a/benchmarks/memory/server/scenarios/request-churn/vue/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/request-churn/vue/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/vue-start/plugin/vite'
import vueJsx from '@vitejs/plugin-vue-jsx'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server request-churn (vue)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/serialization-payload/react/memory.bench.ts b/benchmarks/memory/server/scenarios/serialization-payload/react/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/serialization-payload/react/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/serialization-payload/react/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/serialization-payload/react/vite.config.ts b/benchmarks/memory/server/scenarios/serialization-payload/react/vite.config.ts
index de5549de3b..1ed3bcc335 100644
--- a/benchmarks/memory/server/scenarios/serialization-payload/react/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/serialization-payload/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import react from '@vitejs/plugin-react'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server serialization-payload (react)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/serialization-payload/shared.ts b/benchmarks/memory/server/scenarios/serialization-payload/shared.ts
index ce095b5e10..14ec8f7e0a 100644
--- a/benchmarks/memory/server/scenarios/serialization-payload/shared.ts
+++ b/benchmarks/memory/server/scenarios/serialization-payload/shared.ts
@@ -9,7 +9,7 @@ export type { StartRequestHandler }
type Framework = 'react' | 'solid' | 'vue'
const benchmarkSeed = 0x51eaa11
-const serializationPayloadIterations = 12
+const serializationPayloadIterations = 1
const payloadPageMarker = 'data-bench="serialization-payload"'
const requestInit = {
@@ -55,14 +55,12 @@ export function createWorkloadGroup(
framework: Framework,
handler: StartRequestHandler,
) {
- const run = () =>
+ const run = async () =>
runSequentialRequestLoop(handler, {
seed: benchmarkSeed,
iterations: serializationPayloadIterations,
buildRequest: buildPayloadRequest,
validateResponse: validatePayloadResponse,
- pinGcBetweenIterations: true,
- verifyGcFloor: true,
})
return {
diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/serialization-payload/solid/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/serialization-payload/solid/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/serialization-payload/solid/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/serialization-payload/solid/src/routes/__root.tsx
index 6e83136ea0..aaf7dfdd89 100644
--- a/benchmarks/memory/server/scenarios/serialization-payload/solid/src/routes/__root.tsx
+++ b/benchmarks/memory/server/scenarios/serialization-payload/solid/src/routes/__root.tsx
@@ -4,7 +4,7 @@ import {
Scripts,
createRootRoute,
} from '@tanstack/solid-router'
-import { HydrationScript } from '@solidjs/web'
+import { HydrationScript } from 'solid-js/web'
export const Route = createRootRoute({
head: () => ({
diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/tsconfig.json b/benchmarks/memory/server/scenarios/serialization-payload/solid/tsconfig.json
index cdb88448d7..4b61264e11 100644
--- a/benchmarks/memory/server/scenarios/serialization-payload/solid/tsconfig.json
+++ b/benchmarks/memory/server/scenarios/serialization-payload/solid/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"allowImportingTsExtensions": true,
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/vite.config.ts b/benchmarks/memory/server/scenarios/serialization-payload/solid/vite.config.ts
index 7313699668..a2d04b986c 100644
--- a/benchmarks/memory/server/scenarios/serialization-payload/solid/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/serialization-payload/solid/vite.config.ts
@@ -2,7 +2,8 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/solid-start/plugin/vite'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -14,7 +15,7 @@ export default defineConfig({
tanstackStart({
srcDirectory: 'src',
}),
- solid({ ssr: true, refresh: false, dev: false }),
+ solid({ ssr: true, hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server serialization-payload (solid)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/serialization-payload/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/serialization-payload/vue/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/serialization-payload/vue/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/serialization-payload/vue/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/serialization-payload/vue/src/routes/data.$id.tsx b/benchmarks/memory/server/scenarios/serialization-payload/vue/src/routes/data.$id.tsx
index e6b4cfadfb..37b1a590e4 100644
--- a/benchmarks/memory/server/scenarios/serialization-payload/vue/src/routes/data.$id.tsx
+++ b/benchmarks/memory/server/scenarios/serialization-payload/vue/src/routes/data.$id.tsx
@@ -1,17 +1,20 @@
+import { defineComponent } from 'vue'
import { createFileRoute } from '@tanstack/vue-router'
import { makeSerializationPayload } from '../../../serialization-payload'
+const DataComponent = defineComponent({
+ setup() {
+ const data = Route.useLoaderData()
+
+ return () => (
+
+ Map size: {data.value.lookup.size}
+
+ )
+ },
+})
+
export const Route = createFileRoute('/data/$id')({
loader: ({ params }) => makeSerializationPayload(params.id),
component: DataComponent,
})
-
-function DataComponent() {
- const data = Route.useLoaderData()
-
- return (
-
- Map size: {data.value.lookup.size}
-
- )
-}
diff --git a/benchmarks/memory/server/scenarios/serialization-payload/vue/vite.config.ts b/benchmarks/memory/server/scenarios/serialization-payload/vue/vite.config.ts
index 41a5596adf..b63a561228 100644
--- a/benchmarks/memory/server/scenarios/serialization-payload/vue/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/serialization-payload/vue/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/vue-start/plugin/vite'
import vueJsx from '@vitejs/plugin-vue-jsx'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server serialization-payload (vue)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/react/memory.bench.ts b/benchmarks/memory/server/scenarios/server-fn-churn/react/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/server-fn-churn/react/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/server-fn-churn/react/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/react/vite.config.ts b/benchmarks/memory/server/scenarios/server-fn-churn/react/vite.config.ts
index 68d9ed839b..f72cc53d6f 100644
--- a/benchmarks/memory/server/scenarios/server-fn-churn/react/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/server-fn-churn/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import react from '@vitejs/plugin-react'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server server-fn-churn (react)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/shared.ts b/benchmarks/memory/server/scenarios/server-fn-churn/shared.ts
index a385f28bf5..167b24d3b6 100644
--- a/benchmarks/memory/server/scenarios/server-fn-churn/shared.ts
+++ b/benchmarks/memory/server/scenarios/server-fn-churn/shared.ts
@@ -14,18 +14,12 @@ type FnUrls = {
post: string
}
-export type PayloadFixture = {
+type PayloadFixture = {
id: string
body: string
query: string
}
-export type ServerFnChurnAdapter = {
- buildGetRequest: (url: string, fixture: PayloadFixture) => Request
- buildPostRequest: (url: string, fixture: PayloadFixture) => Request
- validateResponse: (response: Response, request: Request) => void
-}
-
type SerovalNode =
| {
t: 1
@@ -44,8 +38,6 @@ type SerovalNode =
const benchmarkSeed = 0xdecafbad
const payloadSeed = 0x51f0cafe
const fixtureCount = 16
-// Sized to sit just above the 2s measured-run floor on CI (per-iteration
-// cost with the pinned collection is ~0.08-0.11s across frameworks).
const serverFnChurnIterations = 30
const origin = 'http://localhost'
const tssContentTypeFramed = 'application/x-tss-framed'
@@ -168,12 +160,6 @@ function validateServerFnResponse(response: Response, request: Request) {
}
}
-const tanstackServerFnChurnAdapter: ServerFnChurnAdapter = {
- buildGetRequest,
- buildPostRequest,
- validateResponse: validateServerFnResponse,
-}
-
function validateEchoedBody(
body: string,
request: Request,
@@ -193,52 +179,49 @@ function validateEchoedBody(
async function assertServerFnChurnSanity(
handler: StartRequestHandler,
urls: FnUrls,
- adapter: ServerFnChurnAdapter,
) {
const getFixture = getFixtures[0]!
- const getRequest = adapter.buildGetRequest(urls.get, getFixture)
+ const getRequest = buildGetRequest(urls.get, getFixture)
const getResponse = await handler.fetch(getRequest)
const getBody = await getResponse.text()
- adapter.validateResponse(getResponse, getRequest)
+ validateServerFnResponse(getResponse, getRequest)
validateEchoedBody(getBody, getRequest, getFixture.id)
const postFixture = postFixtures[0]!
- const postRequest = adapter.buildPostRequest(urls.post, postFixture)
+ const postRequest = buildPostRequest(urls.post, postFixture)
const postResponse = await handler.fetch(postRequest)
const postBody = await postResponse.text()
- adapter.validateResponse(postResponse, postRequest)
+ validateServerFnResponse(postResponse, postRequest)
validateEchoedBody(postBody, postRequest, postFixture.id)
}
export async function createWorkloadGroup(
framework: Framework,
handler: StartRequestHandler,
- adapter: ServerFnChurnAdapter = tanstackServerFnChurnAdapter,
) {
const urls = await discoverUrls(handler)
- const run = () =>
+ const run = async () =>
runSequentialRequestLoop(handler, {
seed: benchmarkSeed,
iterations: serverFnChurnIterations,
- pinGcBetweenIterations: true,
buildRequest: (_random, index) => {
const fixtureIndex = Math.floor(index / 2) % fixtureCount
if (index % 2 === 0) {
const fixture = getFixtures[fixtureIndex]!
- return adapter.buildGetRequest(urls.get, fixture)
+ return buildGetRequest(urls.get, fixture)
} else {
const fixture = postFixtures[fixtureIndex]!
- return adapter.buildPostRequest(urls.post, fixture)
+ return buildPostRequest(urls.post, fixture)
}
},
- validateResponse: adapter.validateResponse,
+ validateResponse: validateServerFnResponse,
})
return {
- sanity: () => assertServerFnChurnSanity(handler, urls, adapter),
+ sanity: () => assertServerFnChurnSanity(handler, urls),
workloads: [
{
name: `mem server server-fn-churn (${framework})`,
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/adapter.ts b/benchmarks/memory/server/scenarios/server-fn-churn/solid/adapter.ts
deleted file mode 100644
index f23735ce8f..0000000000
--- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/adapter.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import {
- createSolidServerFunctionGetRequest,
- createSolidServerFunctionPostRequest,
- validateSolidServerFunctionResponse,
-} from '../../../../../solid-server-functions'
-import type { PayloadFixture, ServerFnChurnAdapter } from '../shared'
-
-function buildGetRequest(url: string, fixture: PayloadFixture) {
- return createSolidServerFunctionGetRequest(
- url,
- [{ method: 'GET', data: { id: fixture.id } }],
- `memory-get:${fixture.id}`,
- )
-}
-
-function buildPostRequest(url: string, fixture: PayloadFixture) {
- return createSolidServerFunctionPostRequest(
- url,
- [{ method: 'POST', data: { id: fixture.id } }],
- `memory-post:${fixture.id}`,
- )
-}
-
-export const solidServerFnChurnAdapter: ServerFnChurnAdapter = {
- buildGetRequest,
- buildPostRequest,
- validateResponse: validateSolidServerFunctionResponse,
-}
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/server-fn-churn/solid/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/server-fn-churn/solid/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/setup.ts b/benchmarks/memory/server/scenarios/server-fn-churn/solid/setup.ts
index 1a732965b8..4fe85c3f00 100644
--- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/setup.ts
+++ b/benchmarks/memory/server/scenarios/server-fn-churn/solid/setup.ts
@@ -1,6 +1,5 @@
import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark'
import { createWorkloadGroup } from '../shared.ts'
-import { solidServerFnChurnAdapter } from './adapter'
import type { StartRequestHandler } from '../shared.ts'
const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href
@@ -12,4 +11,4 @@ const { default: handler } = (await import(
}
export const workloadGroup: ServerMemoryWorkloadGroup =
- await createWorkloadGroup('solid', handler, solidServerFnChurnAdapter)
+ await createWorkloadGroup('solid', handler)
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routes/__root.tsx
index 6e83136ea0..aaf7dfdd89 100644
--- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routes/__root.tsx
+++ b/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routes/__root.tsx
@@ -4,7 +4,7 @@ import {
Scripts,
createRootRoute,
} from '@tanstack/solid-router'
-import { HydrationScript } from '@solidjs/web'
+import { HydrationScript } from 'solid-js/web'
export const Route = createRootRoute({
head: () => ({
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/tsconfig.json b/benchmarks/memory/server/scenarios/server-fn-churn/solid/tsconfig.json
index cdb88448d7..4b61264e11 100644
--- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/tsconfig.json
+++ b/benchmarks/memory/server/scenarios/server-fn-churn/solid/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"allowImportingTsExtensions": true,
"jsx": "preserve",
- "jsxImportSource": "@solidjs/web",
+ "jsxImportSource": "solid-js",
"types": ["node", "vite/client", "vitest/globals"]
},
"include": [
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/vite.config.ts b/benchmarks/memory/server/scenarios/server-fn-churn/solid/vite.config.ts
index 762bb152e3..4fba196bd2 100644
--- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/server-fn-churn/solid/vite.config.ts
@@ -2,7 +2,8 @@ import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/solid-start/plugin/vite'
-import solid from '@solidjs/vite-plugin'
+import solid from 'vite-plugin-solid'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -14,7 +15,7 @@ export default defineConfig({
tanstackStart({
srcDirectory: 'src',
}),
- solid({ ssr: true, refresh: false, dev: false }),
+ solid({ ssr: true, hot: false, dev: false }),
],
build: {
outDir: './dist',
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server server-fn-churn (solid)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/server-fn-churn/vue/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/server-fn-churn/vue/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/vue/vite.config.ts b/benchmarks/memory/server/scenarios/server-fn-churn/vue/vite.config.ts
index 0e249b9f3b..5ab5ec37e3 100644
--- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/server-fn-churn/vue/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/vue-start/plugin/vite'
import vueJsx from '@vitejs/plugin-vue-jsx'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server server-fn-churn (vue)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/streaming-peak/react/memory.bench.ts b/benchmarks/memory/server/scenarios/streaming-peak/react/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/streaming-peak/react/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/streaming-peak/react/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/streaming-peak/react/vite.config.ts b/benchmarks/memory/server/scenarios/streaming-peak/react/vite.config.ts
index 5af0f0d138..5d555441b6 100644
--- a/benchmarks/memory/server/scenarios/streaming-peak/react/vite.config.ts
+++ b/benchmarks/memory/server/scenarios/streaming-peak/react/vite.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
import codspeedPlugin from '@codspeed/vitest-plugin'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import react from '@vitejs/plugin-react'
+import { memoryConfig } from '../../../../runtime'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@@ -22,19 +23,7 @@ export default defineConfig({
minify: false,
},
test: {
- // Keep lazily-compiled code alive for the whole run: the pinned
- // collections age code fast enough for V8 to flush unused bytecode,
- // and the mid-measurement recompile injects a multi-MB allocation
- // burst at a run-dependent time.
- execArgv: [
- '--no-flush-bytecode',
- // Pre-size the V8 heap so no space has to grow mid-measurement:
- // heap-growth events allocate several MB at a run-dependent moment,
- // which flips the measured peak bimodally between identical runs.
- '--initial-old-space-size=64',
- '--min-semi-space-size=16',
- '--max-semi-space-size=16',
- ],
+ ...memoryConfig('server'),
name: '@benchmarks/memory-server streaming-peak (react)',
watch: false,
environment: 'node',
diff --git a/benchmarks/memory/server/scenarios/streaming-peak/shared.ts b/benchmarks/memory/server/scenarios/streaming-peak/shared.ts
index 6b45470329..c027047408 100644
--- a/benchmarks/memory/server/scenarios/streaming-peak/shared.ts
+++ b/benchmarks/memory/server/scenarios/streaming-peak/shared.ts
@@ -9,7 +9,7 @@ export type { StartRequestHandler }
type Framework = 'react' | 'solid' | 'vue'
const benchmarkSeed = 0xdecafbad
-const streamingPeakIterations = 20
+const streamingPeakIterations = 1
const fallbackMarker = 'streaming-peak-fallback-0'
const requestInit = {
@@ -50,7 +50,7 @@ async function readStreamingBody(response: Response) {
let body = ''
let chunkCount = 0
- while (true) {
+ for (;;) {
const result = await reader.read()
if (result.done) {
@@ -92,18 +92,21 @@ export function createWorkloadGroup(
framework: Framework,
handler: StartRequestHandler,
) {
- const run = () =>
+ const run = async () =>
runSequentialRequestLoop(handler, {
seed: benchmarkSeed,
iterations: streamingPeakIterations,
buildRequest: buildStreamingRequest,
validateResponse: validateStreamingResponse,
- pinGcBetweenIterations: true,
- verifyGcFloor: true,
})
return {
- sanity: () => assertStreamingPeakSanity(handler),
+ sanity: async () => {
+ // Import the route chunks before checking streaming. Cold disk I/O can
+ // otherwise outlast the deferred payload and collapse the first response.
+ await run()
+ await assertStreamingPeakSanity(handler)
+ },
workloads: [
{
name: `mem server streaming-peak chunked (${framework})`,
diff --git a/benchmarks/memory/server/scenarios/streaming-peak/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/streaming-peak/solid/memory.bench.ts
index 138ad2bbde..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/streaming-peak/solid/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/streaming-peak/solid/memory.bench.ts
@@ -1,14 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
+import { workloadGroup } from './setup'
-// TODO(solid-router-v2): re-enable once router-core's SSR stream transformer
-// supports Solid 2's streaming shape. Solid 2's renderToStream emits
-// `