test: stabilize codspeed CPU benchmarks - #7987

Merged
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks
Aug 6, 2026
Merged

test: stabilize codspeed CPU benchmarks#7987
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks

Conversation

@Sheraff

@SheraffSheraff commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Benchmark Improvements
    • Improved client-navigation benchmarks with isolated state, consistent history handling, and more accurate batch completion across React, Solid, and Vue scenarios.
    • Updated SSR benchmarks to support controlled concurrent request workloads and clearer total-request measurement.
  • Bug Fixes
    • Improved request draining and failure handling so benchmark errors are reported reliably without leaving work unfinished.
  • Tests
    • Added comprehensive SSR utility coverage for concurrency limits, streaming responses, deterministic request distribution, and worker failures.
  • Chores
    • Added unit-test and type-checking targets for SSR benchmark validation.

@nx-cloud

nx-cloudBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit fe294d7

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded12m 2sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded1m 41sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-06 14:24:43 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

@coderabbitai

coderabbitaiBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates client-navigation benchmarks to use harness-managed history and per-invocation lifecycle handling. It also changes SSR benchmarks to deterministic concurrent request loops with explicit workload counts, validation tests, Vitest configuration, and TypeScript checking.

Changes

Client-navigation benchmark history

Layer / File(s)Summary
History-aware harness
benchmarks/client-nav/scenarios/harness.ts
The harness supports browser and memory history, timer patching, listener cleanup, deterministic batch settling, history disposal, and fresh mount-loop history.
History propagation
benchmarks/client-nav/scenarios/*/src/main.tsx, benchmarks/client-nav/scenarios/history/*, benchmarks/client-nav/scenarios/rewrites/*
Scenario adapters receive RouterHistory, pass it to routers, and use it for pathname assertions.
Benchmark lifecycle updates
benchmarks/client-nav/scenarios/*/speed.bench.ts, benchmarks/client-nav/package.json
Benchmarks use per-invocation hooks and explicit test.finishBatch(). The client-navigation workspace adds @tanstack/history and jsdom.

SSR benchmark concurrency

Layer / File(s)Summary
Concurrent request-loop engine
benchmarks/ssr/bench-utils.ts
runRequestLoop builds deterministic worker sequences, runs them concurrently, drains response bodies, validates inputs, and propagates settled failures.
Request-loop tests
benchmarks/ssr/bench-utils.test.ts
Unit tests cover concurrency limits, deterministic request assignment, streaming completion, and failure draining.
Scenario workload migration
benchmarks/ssr/scenarios/*
SSR scenarios replace iterations with totalRequests and configure concurrency of 16.
SSR test tooling
benchmarks/ssr/package.json, benchmarks/ssr/tsconfig.json, benchmarks/ssr/vitest.unit.config.ts
The package adds a Vitest unit-test target and enables no-emit TypeScript checking.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
participant Benchmark
participant ClientNavHarness
participant Router
participant History
Benchmark->>ClientNavHarness: create scenario state
ClientNavHarness->>History: create browser or memory history
ClientNavHarness->>Router: mount with RouterHistory
Benchmark->>Router: execute navigation ticks
Benchmark->>ClientNavHarness: finishBatch
ClientNavHarness->>History: dispose history and restore resources
Loading
sequenceDiagram
participant SSRBenchmark
participant runRequestLoop
participant RequestWorkers
participant SSRServer
SSRBenchmark->>runRequestLoop: provide concurrency and totalRequests
runRequestLoop->>RequestWorkers: build and distribute request sequences
RequestWorkers->>SSRServer: execute requests concurrently
SSRServer-->>RequestWorkers: return response bodies
RequestWorkers->>runRequestLoop: drain and validate responses
runRequestLoop-->>SSRBenchmark: resolve or reject after workers settle
Loading

Suggested labels:package: history, package: router-core

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 7.41% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly summarizes the main changes to stabilize CodSpeed CPU benchmarks across client-navigation and SSR benchmark suites.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test-stabilize-cpu-benchmarks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pkg-pr-new

pkg-pr-newBot commented Aug 6, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: fe294d7

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

This pull request does not affect bundle size in any measured scenario.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@benchmarks/client-nav/package.json`:
- Line 22: Update the `@tanstack/history` dependency declaration in package.json
to use the workspace:* protocol instead of workspace:^, preserving it as an
internal workspace dependency.
In `@benchmarks/client-nav/scenarios/harness.ts`:
- Around line 161-166: Update the teardown function returned by
restoreTimeouts() to cancel every tracked setImmediate callback and clear the
tracking collection before restoring targetWindow.setTimeout and
targetWindow.clearTimeout. Ensure pending callbacks cannot run after teardown,
while preserving the existing timer-method restoration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 78324e95-3e8b-4367-8d62-274084374bfb

📥 Commits

Reviewing files that changed from the base of the PR and between ac1d0ab and fe294d7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (98)
  • benchmarks/client-nav/package.json
  • benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/react/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/react/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/harness.ts
  • benchmarks/client-nav/scenarios/head/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/react/src/main.tsx
  • benchmarks/client-nav/scenarios/head/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/head/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/history/react/setup.ts
  • benchmarks/client-nav/scenarios/history/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/react/src/main.tsx
  • benchmarks/client-nav/scenarios/history/shared.ts
  • benchmarks/client-nav/scenarios/history/solid/setup.ts
  • benchmarks/client-nav/scenarios/history/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/history/vue/setup.ts
  • benchmarks/client-nav/scenarios/history/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/links/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/react/src/main.tsx
  • benchmarks/client-nav/scenarios/links/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/links/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/react/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/react/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/react/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/react/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/shared.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/react/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/vue/src/main.tsx
  • benchmarks/ssr/bench-utils.test.ts
  • benchmarks/ssr/bench-utils.ts
  • benchmarks/ssr/package.json
  • benchmarks/ssr/scenarios/assets/shared.ts
  • benchmarks/ssr/scenarios/before-load/shared-bench.ts
  • benchmarks/ssr/scenarios/control-flow/shared.ts
  • benchmarks/ssr/scenarios/global-middleware/bench.ts
  • benchmarks/ssr/scenarios/head/shared.ts
  • benchmarks/ssr/scenarios/loaders/shared-bench.ts
  • benchmarks/ssr/scenarios/rewrites/shared.ts
  • benchmarks/ssr/scenarios/selective-ssr/shared-bench.ts
  • benchmarks/ssr/scenarios/serialization/shared-bench.ts
  • benchmarks/ssr/scenarios/server-fn-transport/bench.ts
  • benchmarks/ssr/scenarios/server-fns/bench.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/shared.ts
  • benchmarks/ssr/scenarios/server-routes/shared.ts
  • benchmarks/ssr/scenarios/streaming/shared-bench.ts
  • benchmarks/ssr/tsconfig.json
  • benchmarks/ssr/vitest.unit.config.ts

"test:types:vue": "tsc -p ./vue/tsconfig.json --noEmit"
},
"dependencies": {
"@tanstack/history": "workspace:^",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the required workspace protocol.

Replace workspace:^ with workspace:* for this internal dependency.

As per coding guidelines, "**/package.json: Use workspace protocol (workspace:*) for internal dependencies."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/package.json` at line 22, Update the `@tanstack/history`
dependency declaration in package.json to use the workspace:* protocol instead
of workspace:^, preserving it as an internal workspace dependency.

Source: Coding guidelines

Comment on lines 161 to +166
return () => {
window.setTimeout = originalSetTimeout as typeof window.setTimeout
window.clearTimeout = originalClearTimeout as typeof window.clearTimeout
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Cancel pending patched timers during teardown.

restoreTimeouts() restores the timer methods but leaves queued setImmediate callbacks active. A callback queued before after() can run after unmount, history destruction, or JSDOM window closure. Cancel and clear all tracked immediates before restoring the methods.

Proposed fix
 return () => {
+ for (const immediate of immediates.values()) {+ clearImmediate(immediate)+ }+ immediates.clear()
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return()=>{
window.setTimeout=originalSetTimeoutastypeofwindow.setTimeout
window.clearTimeout=originalClearTimeoutastypeofwindow.clearTimeout
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
return()=>{
for(constimmediateofimmediates.values()){
clearImmediate(immediate)
}
immediates.clear()
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/scenarios/harness.ts` around lines 161 - 166, Update
the teardown function returned by restoreTimeouts() to cancel every tracked
setImmediate callback and clear the tracking collection before restoring
targetWindow.setTimeout and targetWindow.clearTimeout. Ensure pending callbacks
cannot run after teardown, while preserving the existing timer-method
restoration.

@codspeed-hq

codspeed-hqBot commented Aug 6, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.86%

⚠️Different runtime environments detected

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

Open the report in CodSpeed to investigate

⚡ 28 improved benchmarks
❌ 80 (👁 80) regressed benchmarks
✅ 72 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths not-found (vue)943.8 KB319.2 KB×3
Memorymem server error-paths unmatched (react)440.3 KB273.3 KB+61.09%
Simulationclient-control-flow navigation loop (vue)55.5 ms35.7 ms+55.62%
Simulationclient-rewrites navigation loop (vue)68.1 ms48.1 ms+41.73%
Memorymem client unique-location-churn (solid)473.9 KB342.1 KB+38.52%
Simulationclient-async-pipeline navigation loop (vue)51.6 ms37.2 ms+38.48%
Simulationclient-search-params navigation loop (react)80.7 ms63.5 ms+27.09%
Simulationclient-search-params navigation loop (vue)95.1 ms80.4 ms+18.26%
Simulationclient-control-flow navigation loop (solid)65.7 ms56.3 ms+16.82%
Simulationclient-route-tree-scale navigation loop (vue)76.5 ms66.3 ms+15.41%
Simulationclient-nested-params navigation loop (solid)274.3 ms238.9 ms+14.82%
Simulationclient-search-params navigation loop (solid)131.5 ms115.3 ms+14.01%
Simulationclient-history navigation loop (vue)46.9 ms41.3 ms+13.57%
Simulationclient-head navigation loop (react)73.1 ms64.9 ms+12.77%
Simulationclient-rewrites navigation loop (react)50.6 ms45 ms+12.38%
Simulationclient-control-flow navigation loop (react)66 ms58.9 ms+12.14%
Simulationclient-rewrites navigation loop (solid)84.9 ms76.2 ms+11.31%
Simulationclient-route-tree-scale navigation loop (react)72.3 ms66.4 ms+8.84%
Simulationclient-route-tree-scale navigation loop (solid)131.1 ms120.4 ms+8.83%
Simulationclient-nested-params navigation loop (react)76.9 ms70.7 ms+8.72%
..................

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing test-stabilize-cpu-benchmarks (fe294d7) with main (ac1d0ab)

Open in CodSpeed

@Sheraff
Sheraff merged commit abf9b81 into mainAug 6, 2026
26 checks passed
@Sheraff
Sheraff deleted the test-stabilize-cpu-benchmarks branch August 6, 2026 14:46
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Sheraff
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all \u003cpre\u003e\u003ccode\u003e blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks"); } } catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); } })(); (function(){ try { var __m = "github.com"; var __re = new RegExp('^' + "github\\.com" + '
Skip to content

test: stabilize codspeed CPU benchmarks - #7987

Merged
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks
Aug 6, 2026
Merged

test: stabilize codspeed CPU benchmarks#7987
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks

Conversation

@Sheraff

@SheraffSheraff commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Benchmark Improvements
    • Improved client-navigation benchmarks with isolated state, consistent history handling, and more accurate batch completion across React, Solid, and Vue scenarios.
    • Updated SSR benchmarks to support controlled concurrent request workloads and clearer total-request measurement.
  • Bug Fixes
    • Improved request draining and failure handling so benchmark errors are reported reliably without leaving work unfinished.
  • Tests
    • Added comprehensive SSR utility coverage for concurrency limits, streaming responses, deterministic request distribution, and worker failures.
  • Chores
    • Added unit-test and type-checking targets for SSR benchmark validation.

@nx-cloud

nx-cloudBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit fe294d7

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded12m 2sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded1m 41sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-06 14:24:43 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

@coderabbitai

coderabbitaiBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates client-navigation benchmarks to use harness-managed history and per-invocation lifecycle handling. It also changes SSR benchmarks to deterministic concurrent request loops with explicit workload counts, validation tests, Vitest configuration, and TypeScript checking.

Changes

Client-navigation benchmark history

Layer / File(s)Summary
History-aware harness
benchmarks/client-nav/scenarios/harness.ts
The harness supports browser and memory history, timer patching, listener cleanup, deterministic batch settling, history disposal, and fresh mount-loop history.
History propagation
benchmarks/client-nav/scenarios/*/src/main.tsx, benchmarks/client-nav/scenarios/history/*, benchmarks/client-nav/scenarios/rewrites/*
Scenario adapters receive RouterHistory, pass it to routers, and use it for pathname assertions.
Benchmark lifecycle updates
benchmarks/client-nav/scenarios/*/speed.bench.ts, benchmarks/client-nav/package.json
Benchmarks use per-invocation hooks and explicit test.finishBatch(). The client-navigation workspace adds @tanstack/history and jsdom.

SSR benchmark concurrency

Layer / File(s)Summary
Concurrent request-loop engine
benchmarks/ssr/bench-utils.ts
runRequestLoop builds deterministic worker sequences, runs them concurrently, drains response bodies, validates inputs, and propagates settled failures.
Request-loop tests
benchmarks/ssr/bench-utils.test.ts
Unit tests cover concurrency limits, deterministic request assignment, streaming completion, and failure draining.
Scenario workload migration
benchmarks/ssr/scenarios/*
SSR scenarios replace iterations with totalRequests and configure concurrency of 16.
SSR test tooling
benchmarks/ssr/package.json, benchmarks/ssr/tsconfig.json, benchmarks/ssr/vitest.unit.config.ts
The package adds a Vitest unit-test target and enables no-emit TypeScript checking.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
participant Benchmark
participant ClientNavHarness
participant Router
participant History
Benchmark->>ClientNavHarness: create scenario state
ClientNavHarness->>History: create browser or memory history
ClientNavHarness->>Router: mount with RouterHistory
Benchmark->>Router: execute navigation ticks
Benchmark->>ClientNavHarness: finishBatch
ClientNavHarness->>History: dispose history and restore resources
Loading
sequenceDiagram
participant SSRBenchmark
participant runRequestLoop
participant RequestWorkers
participant SSRServer
SSRBenchmark->>runRequestLoop: provide concurrency and totalRequests
runRequestLoop->>RequestWorkers: build and distribute request sequences
RequestWorkers->>SSRServer: execute requests concurrently
SSRServer-->>RequestWorkers: return response bodies
RequestWorkers->>runRequestLoop: drain and validate responses
runRequestLoop-->>SSRBenchmark: resolve or reject after workers settle
Loading

Suggested labels:package: history, package: router-core

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 7.41% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly summarizes the main changes to stabilize CodSpeed CPU benchmarks across client-navigation and SSR benchmark suites.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test-stabilize-cpu-benchmarks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pkg-pr-new

pkg-pr-newBot commented Aug 6, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: fe294d7

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

This pull request does not affect bundle size in any measured scenario.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@benchmarks/client-nav/package.json`:
- Line 22: Update the `@tanstack/history` dependency declaration in package.json
to use the workspace:* protocol instead of workspace:^, preserving it as an
internal workspace dependency.
In `@benchmarks/client-nav/scenarios/harness.ts`:
- Around line 161-166: Update the teardown function returned by
restoreTimeouts() to cancel every tracked setImmediate callback and clear the
tracking collection before restoring targetWindow.setTimeout and
targetWindow.clearTimeout. Ensure pending callbacks cannot run after teardown,
while preserving the existing timer-method restoration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 78324e95-3e8b-4367-8d62-274084374bfb

📥 Commits

Reviewing files that changed from the base of the PR and between ac1d0ab and fe294d7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (98)
  • benchmarks/client-nav/package.json
  • benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/react/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/react/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/harness.ts
  • benchmarks/client-nav/scenarios/head/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/react/src/main.tsx
  • benchmarks/client-nav/scenarios/head/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/head/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/history/react/setup.ts
  • benchmarks/client-nav/scenarios/history/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/react/src/main.tsx
  • benchmarks/client-nav/scenarios/history/shared.ts
  • benchmarks/client-nav/scenarios/history/solid/setup.ts
  • benchmarks/client-nav/scenarios/history/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/history/vue/setup.ts
  • benchmarks/client-nav/scenarios/history/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/links/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/react/src/main.tsx
  • benchmarks/client-nav/scenarios/links/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/links/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/react/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/react/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/react/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/react/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/shared.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/react/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/vue/src/main.tsx
  • benchmarks/ssr/bench-utils.test.ts
  • benchmarks/ssr/bench-utils.ts
  • benchmarks/ssr/package.json
  • benchmarks/ssr/scenarios/assets/shared.ts
  • benchmarks/ssr/scenarios/before-load/shared-bench.ts
  • benchmarks/ssr/scenarios/control-flow/shared.ts
  • benchmarks/ssr/scenarios/global-middleware/bench.ts
  • benchmarks/ssr/scenarios/head/shared.ts
  • benchmarks/ssr/scenarios/loaders/shared-bench.ts
  • benchmarks/ssr/scenarios/rewrites/shared.ts
  • benchmarks/ssr/scenarios/selective-ssr/shared-bench.ts
  • benchmarks/ssr/scenarios/serialization/shared-bench.ts
  • benchmarks/ssr/scenarios/server-fn-transport/bench.ts
  • benchmarks/ssr/scenarios/server-fns/bench.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/shared.ts
  • benchmarks/ssr/scenarios/server-routes/shared.ts
  • benchmarks/ssr/scenarios/streaming/shared-bench.ts
  • benchmarks/ssr/tsconfig.json
  • benchmarks/ssr/vitest.unit.config.ts

"test:types:vue": "tsc -p ./vue/tsconfig.json --noEmit"
},
"dependencies": {
"@tanstack/history": "workspace:^",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the required workspace protocol.

Replace workspace:^ with workspace:* for this internal dependency.

As per coding guidelines, "**/package.json: Use workspace protocol (workspace:*) for internal dependencies."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/package.json` at line 22, Update the `@tanstack/history`
dependency declaration in package.json to use the workspace:* protocol instead
of workspace:^, preserving it as an internal workspace dependency.

Source: Coding guidelines

Comment on lines 161 to +166
return () => {
window.setTimeout = originalSetTimeout as typeof window.setTimeout
window.clearTimeout = originalClearTimeout as typeof window.clearTimeout
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Cancel pending patched timers during teardown.

restoreTimeouts() restores the timer methods but leaves queued setImmediate callbacks active. A callback queued before after() can run after unmount, history destruction, or JSDOM window closure. Cancel and clear all tracked immediates before restoring the methods.

Proposed fix
 return () => {
+ for (const immediate of immediates.values()) {+ clearImmediate(immediate)+ }+ immediates.clear()
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return()=>{
window.setTimeout=originalSetTimeoutastypeofwindow.setTimeout
window.clearTimeout=originalClearTimeoutastypeofwindow.clearTimeout
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
return()=>{
for(constimmediateofimmediates.values()){
clearImmediate(immediate)
}
immediates.clear()
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/scenarios/harness.ts` around lines 161 - 166, Update
the teardown function returned by restoreTimeouts() to cancel every tracked
setImmediate callback and clear the tracking collection before restoring
targetWindow.setTimeout and targetWindow.clearTimeout. Ensure pending callbacks
cannot run after teardown, while preserving the existing timer-method
restoration.

@codspeed-hq

codspeed-hqBot commented Aug 6, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.86%

⚠️Different runtime environments detected

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

Open the report in CodSpeed to investigate

⚡ 28 improved benchmarks
❌ 80 (👁 80) regressed benchmarks
✅ 72 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths not-found (vue)943.8 KB319.2 KB×3
Memorymem server error-paths unmatched (react)440.3 KB273.3 KB+61.09%
Simulationclient-control-flow navigation loop (vue)55.5 ms35.7 ms+55.62%
Simulationclient-rewrites navigation loop (vue)68.1 ms48.1 ms+41.73%
Memorymem client unique-location-churn (solid)473.9 KB342.1 KB+38.52%
Simulationclient-async-pipeline navigation loop (vue)51.6 ms37.2 ms+38.48%
Simulationclient-search-params navigation loop (react)80.7 ms63.5 ms+27.09%
Simulationclient-search-params navigation loop (vue)95.1 ms80.4 ms+18.26%
Simulationclient-control-flow navigation loop (solid)65.7 ms56.3 ms+16.82%
Simulationclient-route-tree-scale navigation loop (vue)76.5 ms66.3 ms+15.41%
Simulationclient-nested-params navigation loop (solid)274.3 ms238.9 ms+14.82%
Simulationclient-search-params navigation loop (solid)131.5 ms115.3 ms+14.01%
Simulationclient-history navigation loop (vue)46.9 ms41.3 ms+13.57%
Simulationclient-head navigation loop (react)73.1 ms64.9 ms+12.77%
Simulationclient-rewrites navigation loop (react)50.6 ms45 ms+12.38%
Simulationclient-control-flow navigation loop (react)66 ms58.9 ms+12.14%
Simulationclient-rewrites navigation loop (solid)84.9 ms76.2 ms+11.31%
Simulationclient-route-tree-scale navigation loop (react)72.3 ms66.4 ms+8.84%
Simulationclient-route-tree-scale navigation loop (solid)131.1 ms120.4 ms+8.83%
Simulationclient-nested-params navigation loop (react)76.9 ms70.7 ms+8.72%
..................

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing test-stabilize-cpu-benchmarks (fe294d7) with main (ac1d0ab)

Open in CodSpeed

@Sheraff
Sheraff merged commit abf9b81 into mainAug 6, 2026
26 checks passed
@Sheraff
Sheraff deleted the test-stabilize-cpu-benchmarks branch August 6, 2026 14:46
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Sheraff
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

test: stabilize codspeed CPU benchmarks - #7987

Merged
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks
Aug 6, 2026
Merged

test: stabilize codspeed CPU benchmarks#7987
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks

Conversation

@Sheraff

@SheraffSheraff commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Benchmark Improvements
    • Improved client-navigation benchmarks with isolated state, consistent history handling, and more accurate batch completion across React, Solid, and Vue scenarios.
    • Updated SSR benchmarks to support controlled concurrent request workloads and clearer total-request measurement.
  • Bug Fixes
    • Improved request draining and failure handling so benchmark errors are reported reliably without leaving work unfinished.
  • Tests
    • Added comprehensive SSR utility coverage for concurrency limits, streaming responses, deterministic request distribution, and worker failures.
  • Chores
    • Added unit-test and type-checking targets for SSR benchmark validation.

@nx-cloud

nx-cloudBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit fe294d7

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded12m 2sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded1m 41sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-06 14:24:43 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

@coderabbitai

coderabbitaiBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates client-navigation benchmarks to use harness-managed history and per-invocation lifecycle handling. It also changes SSR benchmarks to deterministic concurrent request loops with explicit workload counts, validation tests, Vitest configuration, and TypeScript checking.

Changes

Client-navigation benchmark history

Layer / File(s)Summary
History-aware harness
benchmarks/client-nav/scenarios/harness.ts
The harness supports browser and memory history, timer patching, listener cleanup, deterministic batch settling, history disposal, and fresh mount-loop history.
History propagation
benchmarks/client-nav/scenarios/*/src/main.tsx, benchmarks/client-nav/scenarios/history/*, benchmarks/client-nav/scenarios/rewrites/*
Scenario adapters receive RouterHistory, pass it to routers, and use it for pathname assertions.
Benchmark lifecycle updates
benchmarks/client-nav/scenarios/*/speed.bench.ts, benchmarks/client-nav/package.json
Benchmarks use per-invocation hooks and explicit test.finishBatch(). The client-navigation workspace adds @tanstack/history and jsdom.

SSR benchmark concurrency

Layer / File(s)Summary
Concurrent request-loop engine
benchmarks/ssr/bench-utils.ts
runRequestLoop builds deterministic worker sequences, runs them concurrently, drains response bodies, validates inputs, and propagates settled failures.
Request-loop tests
benchmarks/ssr/bench-utils.test.ts
Unit tests cover concurrency limits, deterministic request assignment, streaming completion, and failure draining.
Scenario workload migration
benchmarks/ssr/scenarios/*
SSR scenarios replace iterations with totalRequests and configure concurrency of 16.
SSR test tooling
benchmarks/ssr/package.json, benchmarks/ssr/tsconfig.json, benchmarks/ssr/vitest.unit.config.ts
The package adds a Vitest unit-test target and enables no-emit TypeScript checking.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
participant Benchmark
participant ClientNavHarness
participant Router
participant History
Benchmark->>ClientNavHarness: create scenario state
ClientNavHarness->>History: create browser or memory history
ClientNavHarness->>Router: mount with RouterHistory
Benchmark->>Router: execute navigation ticks
Benchmark->>ClientNavHarness: finishBatch
ClientNavHarness->>History: dispose history and restore resources
Loading
sequenceDiagram
participant SSRBenchmark
participant runRequestLoop
participant RequestWorkers
participant SSRServer
SSRBenchmark->>runRequestLoop: provide concurrency and totalRequests
runRequestLoop->>RequestWorkers: build and distribute request sequences
RequestWorkers->>SSRServer: execute requests concurrently
SSRServer-->>RequestWorkers: return response bodies
RequestWorkers->>runRequestLoop: drain and validate responses
runRequestLoop-->>SSRBenchmark: resolve or reject after workers settle
Loading

Suggested labels:package: history, package: router-core

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 7.41% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly summarizes the main changes to stabilize CodSpeed CPU benchmarks across client-navigation and SSR benchmark suites.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test-stabilize-cpu-benchmarks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pkg-pr-new

pkg-pr-newBot commented Aug 6, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: fe294d7

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

This pull request does not affect bundle size in any measured scenario.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@benchmarks/client-nav/package.json`:
- Line 22: Update the `@tanstack/history` dependency declaration in package.json
to use the workspace:* protocol instead of workspace:^, preserving it as an
internal workspace dependency.
In `@benchmarks/client-nav/scenarios/harness.ts`:
- Around line 161-166: Update the teardown function returned by
restoreTimeouts() to cancel every tracked setImmediate callback and clear the
tracking collection before restoring targetWindow.setTimeout and
targetWindow.clearTimeout. Ensure pending callbacks cannot run after teardown,
while preserving the existing timer-method restoration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 78324e95-3e8b-4367-8d62-274084374bfb

📥 Commits

Reviewing files that changed from the base of the PR and between ac1d0ab and fe294d7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (98)
  • benchmarks/client-nav/package.json
  • benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/react/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/react/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/harness.ts
  • benchmarks/client-nav/scenarios/head/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/react/src/main.tsx
  • benchmarks/client-nav/scenarios/head/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/head/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/history/react/setup.ts
  • benchmarks/client-nav/scenarios/history/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/react/src/main.tsx
  • benchmarks/client-nav/scenarios/history/shared.ts
  • benchmarks/client-nav/scenarios/history/solid/setup.ts
  • benchmarks/client-nav/scenarios/history/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/history/vue/setup.ts
  • benchmarks/client-nav/scenarios/history/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/links/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/react/src/main.tsx
  • benchmarks/client-nav/scenarios/links/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/links/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/react/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/react/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/react/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/react/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/shared.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/react/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/vue/src/main.tsx
  • benchmarks/ssr/bench-utils.test.ts
  • benchmarks/ssr/bench-utils.ts
  • benchmarks/ssr/package.json
  • benchmarks/ssr/scenarios/assets/shared.ts
  • benchmarks/ssr/scenarios/before-load/shared-bench.ts
  • benchmarks/ssr/scenarios/control-flow/shared.ts
  • benchmarks/ssr/scenarios/global-middleware/bench.ts
  • benchmarks/ssr/scenarios/head/shared.ts
  • benchmarks/ssr/scenarios/loaders/shared-bench.ts
  • benchmarks/ssr/scenarios/rewrites/shared.ts
  • benchmarks/ssr/scenarios/selective-ssr/shared-bench.ts
  • benchmarks/ssr/scenarios/serialization/shared-bench.ts
  • benchmarks/ssr/scenarios/server-fn-transport/bench.ts
  • benchmarks/ssr/scenarios/server-fns/bench.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/shared.ts
  • benchmarks/ssr/scenarios/server-routes/shared.ts
  • benchmarks/ssr/scenarios/streaming/shared-bench.ts
  • benchmarks/ssr/tsconfig.json
  • benchmarks/ssr/vitest.unit.config.ts

"test:types:vue": "tsc -p ./vue/tsconfig.json --noEmit"
},
"dependencies": {
"@tanstack/history": "workspace:^",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the required workspace protocol.

Replace workspace:^ with workspace:* for this internal dependency.

As per coding guidelines, "**/package.json: Use workspace protocol (workspace:*) for internal dependencies."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/package.json` at line 22, Update the `@tanstack/history`
dependency declaration in package.json to use the workspace:* protocol instead
of workspace:^, preserving it as an internal workspace dependency.

Source: Coding guidelines

Comment on lines 161 to +166
return () => {
window.setTimeout = originalSetTimeout as typeof window.setTimeout
window.clearTimeout = originalClearTimeout as typeof window.clearTimeout
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Cancel pending patched timers during teardown.

restoreTimeouts() restores the timer methods but leaves queued setImmediate callbacks active. A callback queued before after() can run after unmount, history destruction, or JSDOM window closure. Cancel and clear all tracked immediates before restoring the methods.

Proposed fix
 return () => {
+ for (const immediate of immediates.values()) {+ clearImmediate(immediate)+ }+ immediates.clear()
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return()=>{
window.setTimeout=originalSetTimeoutastypeofwindow.setTimeout
window.clearTimeout=originalClearTimeoutastypeofwindow.clearTimeout
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
return()=>{
for(constimmediateofimmediates.values()){
clearImmediate(immediate)
}
immediates.clear()
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/scenarios/harness.ts` around lines 161 - 166, Update
the teardown function returned by restoreTimeouts() to cancel every tracked
setImmediate callback and clear the tracking collection before restoring
targetWindow.setTimeout and targetWindow.clearTimeout. Ensure pending callbacks
cannot run after teardown, while preserving the existing timer-method
restoration.

@codspeed-hq

codspeed-hqBot commented Aug 6, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.86%

⚠️Different runtime environments detected

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

Open the report in CodSpeed to investigate

⚡ 28 improved benchmarks
❌ 80 (👁 80) regressed benchmarks
✅ 72 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths not-found (vue)943.8 KB319.2 KB×3
Memorymem server error-paths unmatched (react)440.3 KB273.3 KB+61.09%
Simulationclient-control-flow navigation loop (vue)55.5 ms35.7 ms+55.62%
Simulationclient-rewrites navigation loop (vue)68.1 ms48.1 ms+41.73%
Memorymem client unique-location-churn (solid)473.9 KB342.1 KB+38.52%
Simulationclient-async-pipeline navigation loop (vue)51.6 ms37.2 ms+38.48%
Simulationclient-search-params navigation loop (react)80.7 ms63.5 ms+27.09%
Simulationclient-search-params navigation loop (vue)95.1 ms80.4 ms+18.26%
Simulationclient-control-flow navigation loop (solid)65.7 ms56.3 ms+16.82%
Simulationclient-route-tree-scale navigation loop (vue)76.5 ms66.3 ms+15.41%
Simulationclient-nested-params navigation loop (solid)274.3 ms238.9 ms+14.82%
Simulationclient-search-params navigation loop (solid)131.5 ms115.3 ms+14.01%
Simulationclient-history navigation loop (vue)46.9 ms41.3 ms+13.57%
Simulationclient-head navigation loop (react)73.1 ms64.9 ms+12.77%
Simulationclient-rewrites navigation loop (react)50.6 ms45 ms+12.38%
Simulationclient-control-flow navigation loop (react)66 ms58.9 ms+12.14%
Simulationclient-rewrites navigation loop (solid)84.9 ms76.2 ms+11.31%
Simulationclient-route-tree-scale navigation loop (react)72.3 ms66.4 ms+8.84%
Simulationclient-route-tree-scale navigation loop (solid)131.1 ms120.4 ms+8.83%
Simulationclient-nested-params navigation loop (react)76.9 ms70.7 ms+8.72%
..................

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing test-stabilize-cpu-benchmarks (fe294d7) with main (ac1d0ab)

Open in CodSpeed

@Sheraff
Sheraff merged commit abf9b81 into mainAug 6, 2026
26 checks passed
@Sheraff
Sheraff deleted the test-stabilize-cpu-benchmarks branch August 6, 2026 14:46
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Sheraff
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length \u003e 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

test: stabilize codspeed CPU benchmarks - #7987

Merged
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks
Aug 6, 2026
Merged

test: stabilize codspeed CPU benchmarks#7987
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks

Conversation

@Sheraff

@SheraffSheraff commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Benchmark Improvements
    • Improved client-navigation benchmarks with isolated state, consistent history handling, and more accurate batch completion across React, Solid, and Vue scenarios.
    • Updated SSR benchmarks to support controlled concurrent request workloads and clearer total-request measurement.
  • Bug Fixes
    • Improved request draining and failure handling so benchmark errors are reported reliably without leaving work unfinished.
  • Tests
    • Added comprehensive SSR utility coverage for concurrency limits, streaming responses, deterministic request distribution, and worker failures.
  • Chores
    • Added unit-test and type-checking targets for SSR benchmark validation.

@nx-cloud

nx-cloudBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit fe294d7

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded12m 2sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded1m 41sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-06 14:24:43 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

@coderabbitai

coderabbitaiBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates client-navigation benchmarks to use harness-managed history and per-invocation lifecycle handling. It also changes SSR benchmarks to deterministic concurrent request loops with explicit workload counts, validation tests, Vitest configuration, and TypeScript checking.

Changes

Client-navigation benchmark history

Layer / File(s)Summary
History-aware harness
benchmarks/client-nav/scenarios/harness.ts
The harness supports browser and memory history, timer patching, listener cleanup, deterministic batch settling, history disposal, and fresh mount-loop history.
History propagation
benchmarks/client-nav/scenarios/*/src/main.tsx, benchmarks/client-nav/scenarios/history/*, benchmarks/client-nav/scenarios/rewrites/*
Scenario adapters receive RouterHistory, pass it to routers, and use it for pathname assertions.
Benchmark lifecycle updates
benchmarks/client-nav/scenarios/*/speed.bench.ts, benchmarks/client-nav/package.json
Benchmarks use per-invocation hooks and explicit test.finishBatch(). The client-navigation workspace adds @tanstack/history and jsdom.

SSR benchmark concurrency

Layer / File(s)Summary
Concurrent request-loop engine
benchmarks/ssr/bench-utils.ts
runRequestLoop builds deterministic worker sequences, runs them concurrently, drains response bodies, validates inputs, and propagates settled failures.
Request-loop tests
benchmarks/ssr/bench-utils.test.ts
Unit tests cover concurrency limits, deterministic request assignment, streaming completion, and failure draining.
Scenario workload migration
benchmarks/ssr/scenarios/*
SSR scenarios replace iterations with totalRequests and configure concurrency of 16.
SSR test tooling
benchmarks/ssr/package.json, benchmarks/ssr/tsconfig.json, benchmarks/ssr/vitest.unit.config.ts
The package adds a Vitest unit-test target and enables no-emit TypeScript checking.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
participant Benchmark
participant ClientNavHarness
participant Router
participant History
Benchmark->>ClientNavHarness: create scenario state
ClientNavHarness->>History: create browser or memory history
ClientNavHarness->>Router: mount with RouterHistory
Benchmark->>Router: execute navigation ticks
Benchmark->>ClientNavHarness: finishBatch
ClientNavHarness->>History: dispose history and restore resources
Loading
sequenceDiagram
participant SSRBenchmark
participant runRequestLoop
participant RequestWorkers
participant SSRServer
SSRBenchmark->>runRequestLoop: provide concurrency and totalRequests
runRequestLoop->>RequestWorkers: build and distribute request sequences
RequestWorkers->>SSRServer: execute requests concurrently
SSRServer-->>RequestWorkers: return response bodies
RequestWorkers->>runRequestLoop: drain and validate responses
runRequestLoop-->>SSRBenchmark: resolve or reject after workers settle
Loading

Suggested labels:package: history, package: router-core

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 7.41% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly summarizes the main changes to stabilize CodSpeed CPU benchmarks across client-navigation and SSR benchmark suites.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test-stabilize-cpu-benchmarks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pkg-pr-new

pkg-pr-newBot commented Aug 6, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: fe294d7

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

This pull request does not affect bundle size in any measured scenario.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@benchmarks/client-nav/package.json`:
- Line 22: Update the `@tanstack/history` dependency declaration in package.json
to use the workspace:* protocol instead of workspace:^, preserving it as an
internal workspace dependency.
In `@benchmarks/client-nav/scenarios/harness.ts`:
- Around line 161-166: Update the teardown function returned by
restoreTimeouts() to cancel every tracked setImmediate callback and clear the
tracking collection before restoring targetWindow.setTimeout and
targetWindow.clearTimeout. Ensure pending callbacks cannot run after teardown,
while preserving the existing timer-method restoration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 78324e95-3e8b-4367-8d62-274084374bfb

📥 Commits

Reviewing files that changed from the base of the PR and between ac1d0ab and fe294d7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (98)
  • benchmarks/client-nav/package.json
  • benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/react/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/react/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/harness.ts
  • benchmarks/client-nav/scenarios/head/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/react/src/main.tsx
  • benchmarks/client-nav/scenarios/head/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/head/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/history/react/setup.ts
  • benchmarks/client-nav/scenarios/history/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/react/src/main.tsx
  • benchmarks/client-nav/scenarios/history/shared.ts
  • benchmarks/client-nav/scenarios/history/solid/setup.ts
  • benchmarks/client-nav/scenarios/history/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/history/vue/setup.ts
  • benchmarks/client-nav/scenarios/history/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/links/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/react/src/main.tsx
  • benchmarks/client-nav/scenarios/links/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/links/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/react/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/react/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/react/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/react/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/shared.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/react/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/vue/src/main.tsx
  • benchmarks/ssr/bench-utils.test.ts
  • benchmarks/ssr/bench-utils.ts
  • benchmarks/ssr/package.json
  • benchmarks/ssr/scenarios/assets/shared.ts
  • benchmarks/ssr/scenarios/before-load/shared-bench.ts
  • benchmarks/ssr/scenarios/control-flow/shared.ts
  • benchmarks/ssr/scenarios/global-middleware/bench.ts
  • benchmarks/ssr/scenarios/head/shared.ts
  • benchmarks/ssr/scenarios/loaders/shared-bench.ts
  • benchmarks/ssr/scenarios/rewrites/shared.ts
  • benchmarks/ssr/scenarios/selective-ssr/shared-bench.ts
  • benchmarks/ssr/scenarios/serialization/shared-bench.ts
  • benchmarks/ssr/scenarios/server-fn-transport/bench.ts
  • benchmarks/ssr/scenarios/server-fns/bench.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/shared.ts
  • benchmarks/ssr/scenarios/server-routes/shared.ts
  • benchmarks/ssr/scenarios/streaming/shared-bench.ts
  • benchmarks/ssr/tsconfig.json
  • benchmarks/ssr/vitest.unit.config.ts

"test:types:vue": "tsc -p ./vue/tsconfig.json --noEmit"
},
"dependencies": {
"@tanstack/history": "workspace:^",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the required workspace protocol.

Replace workspace:^ with workspace:* for this internal dependency.

As per coding guidelines, "**/package.json: Use workspace protocol (workspace:*) for internal dependencies."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/package.json` at line 22, Update the `@tanstack/history`
dependency declaration in package.json to use the workspace:* protocol instead
of workspace:^, preserving it as an internal workspace dependency.

Source: Coding guidelines

Comment on lines 161 to +166
return () => {
window.setTimeout = originalSetTimeout as typeof window.setTimeout
window.clearTimeout = originalClearTimeout as typeof window.clearTimeout
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Cancel pending patched timers during teardown.

restoreTimeouts() restores the timer methods but leaves queued setImmediate callbacks active. A callback queued before after() can run after unmount, history destruction, or JSDOM window closure. Cancel and clear all tracked immediates before restoring the methods.

Proposed fix
 return () => {
+ for (const immediate of immediates.values()) {+ clearImmediate(immediate)+ }+ immediates.clear()
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return()=>{
window.setTimeout=originalSetTimeoutastypeofwindow.setTimeout
window.clearTimeout=originalClearTimeoutastypeofwindow.clearTimeout
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
return()=>{
for(constimmediateofimmediates.values()){
clearImmediate(immediate)
}
immediates.clear()
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/scenarios/harness.ts` around lines 161 - 166, Update
the teardown function returned by restoreTimeouts() to cancel every tracked
setImmediate callback and clear the tracking collection before restoring
targetWindow.setTimeout and targetWindow.clearTimeout. Ensure pending callbacks
cannot run after teardown, while preserving the existing timer-method
restoration.

@codspeed-hq

codspeed-hqBot commented Aug 6, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.86%

⚠️Different runtime environments detected

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

Open the report in CodSpeed to investigate

⚡ 28 improved benchmarks
❌ 80 (👁 80) regressed benchmarks
✅ 72 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths not-found (vue)943.8 KB319.2 KB×3
Memorymem server error-paths unmatched (react)440.3 KB273.3 KB+61.09%
Simulationclient-control-flow navigation loop (vue)55.5 ms35.7 ms+55.62%
Simulationclient-rewrites navigation loop (vue)68.1 ms48.1 ms+41.73%
Memorymem client unique-location-churn (solid)473.9 KB342.1 KB+38.52%
Simulationclient-async-pipeline navigation loop (vue)51.6 ms37.2 ms+38.48%
Simulationclient-search-params navigation loop (react)80.7 ms63.5 ms+27.09%
Simulationclient-search-params navigation loop (vue)95.1 ms80.4 ms+18.26%
Simulationclient-control-flow navigation loop (solid)65.7 ms56.3 ms+16.82%
Simulationclient-route-tree-scale navigation loop (vue)76.5 ms66.3 ms+15.41%
Simulationclient-nested-params navigation loop (solid)274.3 ms238.9 ms+14.82%
Simulationclient-search-params navigation loop (solid)131.5 ms115.3 ms+14.01%
Simulationclient-history navigation loop (vue)46.9 ms41.3 ms+13.57%
Simulationclient-head navigation loop (react)73.1 ms64.9 ms+12.77%
Simulationclient-rewrites navigation loop (react)50.6 ms45 ms+12.38%
Simulationclient-control-flow navigation loop (react)66 ms58.9 ms+12.14%
Simulationclient-rewrites navigation loop (solid)84.9 ms76.2 ms+11.31%
Simulationclient-route-tree-scale navigation loop (react)72.3 ms66.4 ms+8.84%
Simulationclient-route-tree-scale navigation loop (solid)131.1 ms120.4 ms+8.83%
Simulationclient-nested-params navigation loop (react)76.9 ms70.7 ms+8.72%
..................

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing test-stabilize-cpu-benchmarks (fe294d7) with main (ac1d0ab)

Open in CodSpeed

@Sheraff
Sheraff merged commit abf9b81 into mainAug 6, 2026
26 checks passed
@Sheraff
Sheraff deleted the test-stabilize-cpu-benchmarks branch August 6, 2026 14:46
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Sheraff
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

test: stabilize codspeed CPU benchmarks - #7987

Merged
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks
Aug 6, 2026
Merged

test: stabilize codspeed CPU benchmarks#7987
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks

Conversation

@Sheraff

@SheraffSheraff commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Benchmark Improvements
    • Improved client-navigation benchmarks with isolated state, consistent history handling, and more accurate batch completion across React, Solid, and Vue scenarios.
    • Updated SSR benchmarks to support controlled concurrent request workloads and clearer total-request measurement.
  • Bug Fixes
    • Improved request draining and failure handling so benchmark errors are reported reliably without leaving work unfinished.
  • Tests
    • Added comprehensive SSR utility coverage for concurrency limits, streaming responses, deterministic request distribution, and worker failures.
  • Chores
    • Added unit-test and type-checking targets for SSR benchmark validation.

@nx-cloud

nx-cloudBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit fe294d7

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded12m 2sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded1m 41sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-06 14:24:43 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

@coderabbitai

coderabbitaiBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates client-navigation benchmarks to use harness-managed history and per-invocation lifecycle handling. It also changes SSR benchmarks to deterministic concurrent request loops with explicit workload counts, validation tests, Vitest configuration, and TypeScript checking.

Changes

Client-navigation benchmark history

Layer / File(s)Summary
History-aware harness
benchmarks/client-nav/scenarios/harness.ts
The harness supports browser and memory history, timer patching, listener cleanup, deterministic batch settling, history disposal, and fresh mount-loop history.
History propagation
benchmarks/client-nav/scenarios/*/src/main.tsx, benchmarks/client-nav/scenarios/history/*, benchmarks/client-nav/scenarios/rewrites/*
Scenario adapters receive RouterHistory, pass it to routers, and use it for pathname assertions.
Benchmark lifecycle updates
benchmarks/client-nav/scenarios/*/speed.bench.ts, benchmarks/client-nav/package.json
Benchmarks use per-invocation hooks and explicit test.finishBatch(). The client-navigation workspace adds @tanstack/history and jsdom.

SSR benchmark concurrency

Layer / File(s)Summary
Concurrent request-loop engine
benchmarks/ssr/bench-utils.ts
runRequestLoop builds deterministic worker sequences, runs them concurrently, drains response bodies, validates inputs, and propagates settled failures.
Request-loop tests
benchmarks/ssr/bench-utils.test.ts
Unit tests cover concurrency limits, deterministic request assignment, streaming completion, and failure draining.
Scenario workload migration
benchmarks/ssr/scenarios/*
SSR scenarios replace iterations with totalRequests and configure concurrency of 16.
SSR test tooling
benchmarks/ssr/package.json, benchmarks/ssr/tsconfig.json, benchmarks/ssr/vitest.unit.config.ts
The package adds a Vitest unit-test target and enables no-emit TypeScript checking.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
participant Benchmark
participant ClientNavHarness
participant Router
participant History
Benchmark->>ClientNavHarness: create scenario state
ClientNavHarness->>History: create browser or memory history
ClientNavHarness->>Router: mount with RouterHistory
Benchmark->>Router: execute navigation ticks
Benchmark->>ClientNavHarness: finishBatch
ClientNavHarness->>History: dispose history and restore resources
Loading
sequenceDiagram
participant SSRBenchmark
participant runRequestLoop
participant RequestWorkers
participant SSRServer
SSRBenchmark->>runRequestLoop: provide concurrency and totalRequests
runRequestLoop->>RequestWorkers: build and distribute request sequences
RequestWorkers->>SSRServer: execute requests concurrently
SSRServer-->>RequestWorkers: return response bodies
RequestWorkers->>runRequestLoop: drain and validate responses
runRequestLoop-->>SSRBenchmark: resolve or reject after workers settle
Loading

Suggested labels:package: history, package: router-core

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 7.41% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly summarizes the main changes to stabilize CodSpeed CPU benchmarks across client-navigation and SSR benchmark suites.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test-stabilize-cpu-benchmarks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pkg-pr-new

pkg-pr-newBot commented Aug 6, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: fe294d7

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

This pull request does not affect bundle size in any measured scenario.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@benchmarks/client-nav/package.json`:
- Line 22: Update the `@tanstack/history` dependency declaration in package.json
to use the workspace:* protocol instead of workspace:^, preserving it as an
internal workspace dependency.
In `@benchmarks/client-nav/scenarios/harness.ts`:
- Around line 161-166: Update the teardown function returned by
restoreTimeouts() to cancel every tracked setImmediate callback and clear the
tracking collection before restoring targetWindow.setTimeout and
targetWindow.clearTimeout. Ensure pending callbacks cannot run after teardown,
while preserving the existing timer-method restoration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 78324e95-3e8b-4367-8d62-274084374bfb

📥 Commits

Reviewing files that changed from the base of the PR and between ac1d0ab and fe294d7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (98)
  • benchmarks/client-nav/package.json
  • benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/react/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/react/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/harness.ts
  • benchmarks/client-nav/scenarios/head/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/react/src/main.tsx
  • benchmarks/client-nav/scenarios/head/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/head/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/history/react/setup.ts
  • benchmarks/client-nav/scenarios/history/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/react/src/main.tsx
  • benchmarks/client-nav/scenarios/history/shared.ts
  • benchmarks/client-nav/scenarios/history/solid/setup.ts
  • benchmarks/client-nav/scenarios/history/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/history/vue/setup.ts
  • benchmarks/client-nav/scenarios/history/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/links/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/react/src/main.tsx
  • benchmarks/client-nav/scenarios/links/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/links/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/react/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/react/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/react/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/react/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/shared.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/react/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/vue/src/main.tsx
  • benchmarks/ssr/bench-utils.test.ts
  • benchmarks/ssr/bench-utils.ts
  • benchmarks/ssr/package.json
  • benchmarks/ssr/scenarios/assets/shared.ts
  • benchmarks/ssr/scenarios/before-load/shared-bench.ts
  • benchmarks/ssr/scenarios/control-flow/shared.ts
  • benchmarks/ssr/scenarios/global-middleware/bench.ts
  • benchmarks/ssr/scenarios/head/shared.ts
  • benchmarks/ssr/scenarios/loaders/shared-bench.ts
  • benchmarks/ssr/scenarios/rewrites/shared.ts
  • benchmarks/ssr/scenarios/selective-ssr/shared-bench.ts
  • benchmarks/ssr/scenarios/serialization/shared-bench.ts
  • benchmarks/ssr/scenarios/server-fn-transport/bench.ts
  • benchmarks/ssr/scenarios/server-fns/bench.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/shared.ts
  • benchmarks/ssr/scenarios/server-routes/shared.ts
  • benchmarks/ssr/scenarios/streaming/shared-bench.ts
  • benchmarks/ssr/tsconfig.json
  • benchmarks/ssr/vitest.unit.config.ts

"test:types:vue": "tsc -p ./vue/tsconfig.json --noEmit"
},
"dependencies": {
"@tanstack/history": "workspace:^",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the required workspace protocol.

Replace workspace:^ with workspace:* for this internal dependency.

As per coding guidelines, "**/package.json: Use workspace protocol (workspace:*) for internal dependencies."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/package.json` at line 22, Update the `@tanstack/history`
dependency declaration in package.json to use the workspace:* protocol instead
of workspace:^, preserving it as an internal workspace dependency.

Source: Coding guidelines

Comment on lines 161 to +166
return () => {
window.setTimeout = originalSetTimeout as typeof window.setTimeout
window.clearTimeout = originalClearTimeout as typeof window.clearTimeout
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Cancel pending patched timers during teardown.

restoreTimeouts() restores the timer methods but leaves queued setImmediate callbacks active. A callback queued before after() can run after unmount, history destruction, or JSDOM window closure. Cancel and clear all tracked immediates before restoring the methods.

Proposed fix
 return () => {
+ for (const immediate of immediates.values()) {+ clearImmediate(immediate)+ }+ immediates.clear()
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return()=>{
window.setTimeout=originalSetTimeoutastypeofwindow.setTimeout
window.clearTimeout=originalClearTimeoutastypeofwindow.clearTimeout
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
return()=>{
for(constimmediateofimmediates.values()){
clearImmediate(immediate)
}
immediates.clear()
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/scenarios/harness.ts` around lines 161 - 166, Update
the teardown function returned by restoreTimeouts() to cancel every tracked
setImmediate callback and clear the tracking collection before restoring
targetWindow.setTimeout and targetWindow.clearTimeout. Ensure pending callbacks
cannot run after teardown, while preserving the existing timer-method
restoration.

@codspeed-hq

codspeed-hqBot commented Aug 6, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.86%

⚠️Different runtime environments detected

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

Open the report in CodSpeed to investigate

⚡ 28 improved benchmarks
❌ 80 (👁 80) regressed benchmarks
✅ 72 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths not-found (vue)943.8 KB319.2 KB×3
Memorymem server error-paths unmatched (react)440.3 KB273.3 KB+61.09%
Simulationclient-control-flow navigation loop (vue)55.5 ms35.7 ms+55.62%
Simulationclient-rewrites navigation loop (vue)68.1 ms48.1 ms+41.73%
Memorymem client unique-location-churn (solid)473.9 KB342.1 KB+38.52%
Simulationclient-async-pipeline navigation loop (vue)51.6 ms37.2 ms+38.48%
Simulationclient-search-params navigation loop (react)80.7 ms63.5 ms+27.09%
Simulationclient-search-params navigation loop (vue)95.1 ms80.4 ms+18.26%
Simulationclient-control-flow navigation loop (solid)65.7 ms56.3 ms+16.82%
Simulationclient-route-tree-scale navigation loop (vue)76.5 ms66.3 ms+15.41%
Simulationclient-nested-params navigation loop (solid)274.3 ms238.9 ms+14.82%
Simulationclient-search-params navigation loop (solid)131.5 ms115.3 ms+14.01%
Simulationclient-history navigation loop (vue)46.9 ms41.3 ms+13.57%
Simulationclient-head navigation loop (react)73.1 ms64.9 ms+12.77%
Simulationclient-rewrites navigation loop (react)50.6 ms45 ms+12.38%
Simulationclient-control-flow navigation loop (react)66 ms58.9 ms+12.14%
Simulationclient-rewrites navigation loop (solid)84.9 ms76.2 ms+11.31%
Simulationclient-route-tree-scale navigation loop (react)72.3 ms66.4 ms+8.84%
Simulationclient-route-tree-scale navigation loop (solid)131.1 ms120.4 ms+8.83%
Simulationclient-nested-params navigation loop (react)76.9 ms70.7 ms+8.72%
..................

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing test-stabilize-cpu-benchmarks (fe294d7) with main (ac1d0ab)

Open in CodSpeed

@Sheraff
Sheraff merged commit abf9b81 into mainAug 6, 2026
26 checks passed
@Sheraff
Sheraff deleted the test-stabilize-cpu-benchmarks branch August 6, 2026 14:46
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Sheraff
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

test: stabilize codspeed CPU benchmarks - #7987

Merged
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks
Aug 6, 2026
Merged

test: stabilize codspeed CPU benchmarks#7987
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks

Conversation

@Sheraff

@SheraffSheraff commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Benchmark Improvements
    • Improved client-navigation benchmarks with isolated state, consistent history handling, and more accurate batch completion across React, Solid, and Vue scenarios.
    • Updated SSR benchmarks to support controlled concurrent request workloads and clearer total-request measurement.
  • Bug Fixes
    • Improved request draining and failure handling so benchmark errors are reported reliably without leaving work unfinished.
  • Tests
    • Added comprehensive SSR utility coverage for concurrency limits, streaming responses, deterministic request distribution, and worker failures.
  • Chores
    • Added unit-test and type-checking targets for SSR benchmark validation.

@nx-cloud

nx-cloudBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit fe294d7

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded12m 2sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded1m 41sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-06 14:24:43 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

@coderabbitai

coderabbitaiBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates client-navigation benchmarks to use harness-managed history and per-invocation lifecycle handling. It also changes SSR benchmarks to deterministic concurrent request loops with explicit workload counts, validation tests, Vitest configuration, and TypeScript checking.

Changes

Client-navigation benchmark history

Layer / File(s)Summary
History-aware harness
benchmarks/client-nav/scenarios/harness.ts
The harness supports browser and memory history, timer patching, listener cleanup, deterministic batch settling, history disposal, and fresh mount-loop history.
History propagation
benchmarks/client-nav/scenarios/*/src/main.tsx, benchmarks/client-nav/scenarios/history/*, benchmarks/client-nav/scenarios/rewrites/*
Scenario adapters receive RouterHistory, pass it to routers, and use it for pathname assertions.
Benchmark lifecycle updates
benchmarks/client-nav/scenarios/*/speed.bench.ts, benchmarks/client-nav/package.json
Benchmarks use per-invocation hooks and explicit test.finishBatch(). The client-navigation workspace adds @tanstack/history and jsdom.

SSR benchmark concurrency

Layer / File(s)Summary
Concurrent request-loop engine
benchmarks/ssr/bench-utils.ts
runRequestLoop builds deterministic worker sequences, runs them concurrently, drains response bodies, validates inputs, and propagates settled failures.
Request-loop tests
benchmarks/ssr/bench-utils.test.ts
Unit tests cover concurrency limits, deterministic request assignment, streaming completion, and failure draining.
Scenario workload migration
benchmarks/ssr/scenarios/*
SSR scenarios replace iterations with totalRequests and configure concurrency of 16.
SSR test tooling
benchmarks/ssr/package.json, benchmarks/ssr/tsconfig.json, benchmarks/ssr/vitest.unit.config.ts
The package adds a Vitest unit-test target and enables no-emit TypeScript checking.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
participant Benchmark
participant ClientNavHarness
participant Router
participant History
Benchmark->>ClientNavHarness: create scenario state
ClientNavHarness->>History: create browser or memory history
ClientNavHarness->>Router: mount with RouterHistory
Benchmark->>Router: execute navigation ticks
Benchmark->>ClientNavHarness: finishBatch
ClientNavHarness->>History: dispose history and restore resources
Loading
sequenceDiagram
participant SSRBenchmark
participant runRequestLoop
participant RequestWorkers
participant SSRServer
SSRBenchmark->>runRequestLoop: provide concurrency and totalRequests
runRequestLoop->>RequestWorkers: build and distribute request sequences
RequestWorkers->>SSRServer: execute requests concurrently
SSRServer-->>RequestWorkers: return response bodies
RequestWorkers->>runRequestLoop: drain and validate responses
runRequestLoop-->>SSRBenchmark: resolve or reject after workers settle
Loading

Suggested labels:package: history, package: router-core

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 7.41% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly summarizes the main changes to stabilize CodSpeed CPU benchmarks across client-navigation and SSR benchmark suites.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test-stabilize-cpu-benchmarks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pkg-pr-new

pkg-pr-newBot commented Aug 6, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: fe294d7

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

This pull request does not affect bundle size in any measured scenario.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@benchmarks/client-nav/package.json`:
- Line 22: Update the `@tanstack/history` dependency declaration in package.json
to use the workspace:* protocol instead of workspace:^, preserving it as an
internal workspace dependency.
In `@benchmarks/client-nav/scenarios/harness.ts`:
- Around line 161-166: Update the teardown function returned by
restoreTimeouts() to cancel every tracked setImmediate callback and clear the
tracking collection before restoring targetWindow.setTimeout and
targetWindow.clearTimeout. Ensure pending callbacks cannot run after teardown,
while preserving the existing timer-method restoration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 78324e95-3e8b-4367-8d62-274084374bfb

📥 Commits

Reviewing files that changed from the base of the PR and between ac1d0ab and fe294d7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (98)
  • benchmarks/client-nav/package.json
  • benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/react/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/react/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/harness.ts
  • benchmarks/client-nav/scenarios/head/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/react/src/main.tsx
  • benchmarks/client-nav/scenarios/head/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/head/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/history/react/setup.ts
  • benchmarks/client-nav/scenarios/history/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/react/src/main.tsx
  • benchmarks/client-nav/scenarios/history/shared.ts
  • benchmarks/client-nav/scenarios/history/solid/setup.ts
  • benchmarks/client-nav/scenarios/history/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/history/vue/setup.ts
  • benchmarks/client-nav/scenarios/history/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/links/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/react/src/main.tsx
  • benchmarks/client-nav/scenarios/links/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/links/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/react/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/react/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/react/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/react/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/shared.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/react/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/vue/src/main.tsx
  • benchmarks/ssr/bench-utils.test.ts
  • benchmarks/ssr/bench-utils.ts
  • benchmarks/ssr/package.json
  • benchmarks/ssr/scenarios/assets/shared.ts
  • benchmarks/ssr/scenarios/before-load/shared-bench.ts
  • benchmarks/ssr/scenarios/control-flow/shared.ts
  • benchmarks/ssr/scenarios/global-middleware/bench.ts
  • benchmarks/ssr/scenarios/head/shared.ts
  • benchmarks/ssr/scenarios/loaders/shared-bench.ts
  • benchmarks/ssr/scenarios/rewrites/shared.ts
  • benchmarks/ssr/scenarios/selective-ssr/shared-bench.ts
  • benchmarks/ssr/scenarios/serialization/shared-bench.ts
  • benchmarks/ssr/scenarios/server-fn-transport/bench.ts
  • benchmarks/ssr/scenarios/server-fns/bench.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/shared.ts
  • benchmarks/ssr/scenarios/server-routes/shared.ts
  • benchmarks/ssr/scenarios/streaming/shared-bench.ts
  • benchmarks/ssr/tsconfig.json
  • benchmarks/ssr/vitest.unit.config.ts

"test:types:vue": "tsc -p ./vue/tsconfig.json --noEmit"
},
"dependencies": {
"@tanstack/history": "workspace:^",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the required workspace protocol.

Replace workspace:^ with workspace:* for this internal dependency.

As per coding guidelines, "**/package.json: Use workspace protocol (workspace:*) for internal dependencies."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/package.json` at line 22, Update the `@tanstack/history`
dependency declaration in package.json to use the workspace:* protocol instead
of workspace:^, preserving it as an internal workspace dependency.

Source: Coding guidelines

Comment on lines 161 to +166
return () => {
window.setTimeout = originalSetTimeout as typeof window.setTimeout
window.clearTimeout = originalClearTimeout as typeof window.clearTimeout
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Cancel pending patched timers during teardown.

restoreTimeouts() restores the timer methods but leaves queued setImmediate callbacks active. A callback queued before after() can run after unmount, history destruction, or JSDOM window closure. Cancel and clear all tracked immediates before restoring the methods.

Proposed fix
 return () => {
+ for (const immediate of immediates.values()) {+ clearImmediate(immediate)+ }+ immediates.clear()
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return()=>{
window.setTimeout=originalSetTimeoutastypeofwindow.setTimeout
window.clearTimeout=originalClearTimeoutastypeofwindow.clearTimeout
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
return()=>{
for(constimmediateofimmediates.values()){
clearImmediate(immediate)
}
immediates.clear()
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/scenarios/harness.ts` around lines 161 - 166, Update
the teardown function returned by restoreTimeouts() to cancel every tracked
setImmediate callback and clear the tracking collection before restoring
targetWindow.setTimeout and targetWindow.clearTimeout. Ensure pending callbacks
cannot run after teardown, while preserving the existing timer-method
restoration.

@codspeed-hq

codspeed-hqBot commented Aug 6, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.86%

⚠️Different runtime environments detected

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

Open the report in CodSpeed to investigate

⚡ 28 improved benchmarks
❌ 80 (👁 80) regressed benchmarks
✅ 72 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths not-found (vue)943.8 KB319.2 KB×3
Memorymem server error-paths unmatched (react)440.3 KB273.3 KB+61.09%
Simulationclient-control-flow navigation loop (vue)55.5 ms35.7 ms+55.62%
Simulationclient-rewrites navigation loop (vue)68.1 ms48.1 ms+41.73%
Memorymem client unique-location-churn (solid)473.9 KB342.1 KB+38.52%
Simulationclient-async-pipeline navigation loop (vue)51.6 ms37.2 ms+38.48%
Simulationclient-search-params navigation loop (react)80.7 ms63.5 ms+27.09%
Simulationclient-search-params navigation loop (vue)95.1 ms80.4 ms+18.26%
Simulationclient-control-flow navigation loop (solid)65.7 ms56.3 ms+16.82%
Simulationclient-route-tree-scale navigation loop (vue)76.5 ms66.3 ms+15.41%
Simulationclient-nested-params navigation loop (solid)274.3 ms238.9 ms+14.82%
Simulationclient-search-params navigation loop (solid)131.5 ms115.3 ms+14.01%
Simulationclient-history navigation loop (vue)46.9 ms41.3 ms+13.57%
Simulationclient-head navigation loop (react)73.1 ms64.9 ms+12.77%
Simulationclient-rewrites navigation loop (react)50.6 ms45 ms+12.38%
Simulationclient-control-flow navigation loop (react)66 ms58.9 ms+12.14%
Simulationclient-rewrites navigation loop (solid)84.9 ms76.2 ms+11.31%
Simulationclient-route-tree-scale navigation loop (react)72.3 ms66.4 ms+8.84%
Simulationclient-route-tree-scale navigation loop (solid)131.1 ms120.4 ms+8.83%
Simulationclient-nested-params navigation loop (react)76.9 ms70.7 ms+8.72%
..................

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing test-stabilize-cpu-benchmarks (fe294d7) with main (ac1d0ab)

Open in CodSpeed

@Sheraff
Sheraff merged commit abf9b81 into mainAug 6, 2026
26 checks passed
@Sheraff
Sheraff deleted the test-stabilize-cpu-benchmarks branch August 6, 2026 14:46
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Sheraff
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

test: stabilize codspeed CPU benchmarks - #7987

Merged
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks
Aug 6, 2026
Merged

test: stabilize codspeed CPU benchmarks#7987
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks

Conversation

@Sheraff

@SheraffSheraff commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Benchmark Improvements
    • Improved client-navigation benchmarks with isolated state, consistent history handling, and more accurate batch completion across React, Solid, and Vue scenarios.
    • Updated SSR benchmarks to support controlled concurrent request workloads and clearer total-request measurement.
  • Bug Fixes
    • Improved request draining and failure handling so benchmark errors are reported reliably without leaving work unfinished.
  • Tests
    • Added comprehensive SSR utility coverage for concurrency limits, streaming responses, deterministic request distribution, and worker failures.
  • Chores
    • Added unit-test and type-checking targets for SSR benchmark validation.

@nx-cloud

nx-cloudBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit fe294d7

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded12m 2sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded1m 41sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-06 14:24:43 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

@coderabbitai

coderabbitaiBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates client-navigation benchmarks to use harness-managed history and per-invocation lifecycle handling. It also changes SSR benchmarks to deterministic concurrent request loops with explicit workload counts, validation tests, Vitest configuration, and TypeScript checking.

Changes

Client-navigation benchmark history

Layer / File(s)Summary
History-aware harness
benchmarks/client-nav/scenarios/harness.ts
The harness supports browser and memory history, timer patching, listener cleanup, deterministic batch settling, history disposal, and fresh mount-loop history.
History propagation
benchmarks/client-nav/scenarios/*/src/main.tsx, benchmarks/client-nav/scenarios/history/*, benchmarks/client-nav/scenarios/rewrites/*
Scenario adapters receive RouterHistory, pass it to routers, and use it for pathname assertions.
Benchmark lifecycle updates
benchmarks/client-nav/scenarios/*/speed.bench.ts, benchmarks/client-nav/package.json
Benchmarks use per-invocation hooks and explicit test.finishBatch(). The client-navigation workspace adds @tanstack/history and jsdom.

SSR benchmark concurrency

Layer / File(s)Summary
Concurrent request-loop engine
benchmarks/ssr/bench-utils.ts
runRequestLoop builds deterministic worker sequences, runs them concurrently, drains response bodies, validates inputs, and propagates settled failures.
Request-loop tests
benchmarks/ssr/bench-utils.test.ts
Unit tests cover concurrency limits, deterministic request assignment, streaming completion, and failure draining.
Scenario workload migration
benchmarks/ssr/scenarios/*
SSR scenarios replace iterations with totalRequests and configure concurrency of 16.
SSR test tooling
benchmarks/ssr/package.json, benchmarks/ssr/tsconfig.json, benchmarks/ssr/vitest.unit.config.ts
The package adds a Vitest unit-test target and enables no-emit TypeScript checking.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
participant Benchmark
participant ClientNavHarness
participant Router
participant History
Benchmark->>ClientNavHarness: create scenario state
ClientNavHarness->>History: create browser or memory history
ClientNavHarness->>Router: mount with RouterHistory
Benchmark->>Router: execute navigation ticks
Benchmark->>ClientNavHarness: finishBatch
ClientNavHarness->>History: dispose history and restore resources
Loading
sequenceDiagram
participant SSRBenchmark
participant runRequestLoop
participant RequestWorkers
participant SSRServer
SSRBenchmark->>runRequestLoop: provide concurrency and totalRequests
runRequestLoop->>RequestWorkers: build and distribute request sequences
RequestWorkers->>SSRServer: execute requests concurrently
SSRServer-->>RequestWorkers: return response bodies
RequestWorkers->>runRequestLoop: drain and validate responses
runRequestLoop-->>SSRBenchmark: resolve or reject after workers settle
Loading

Suggested labels:package: history, package: router-core

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 7.41% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly summarizes the main changes to stabilize CodSpeed CPU benchmarks across client-navigation and SSR benchmark suites.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test-stabilize-cpu-benchmarks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pkg-pr-new

pkg-pr-newBot commented Aug 6, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: fe294d7

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

This pull request does not affect bundle size in any measured scenario.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@benchmarks/client-nav/package.json`:
- Line 22: Update the `@tanstack/history` dependency declaration in package.json
to use the workspace:* protocol instead of workspace:^, preserving it as an
internal workspace dependency.
In `@benchmarks/client-nav/scenarios/harness.ts`:
- Around line 161-166: Update the teardown function returned by
restoreTimeouts() to cancel every tracked setImmediate callback and clear the
tracking collection before restoring targetWindow.setTimeout and
targetWindow.clearTimeout. Ensure pending callbacks cannot run after teardown,
while preserving the existing timer-method restoration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 78324e95-3e8b-4367-8d62-274084374bfb

📥 Commits

Reviewing files that changed from the base of the PR and between ac1d0ab and fe294d7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (98)
  • benchmarks/client-nav/package.json
  • benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/react/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/react/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/harness.ts
  • benchmarks/client-nav/scenarios/head/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/react/src/main.tsx
  • benchmarks/client-nav/scenarios/head/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/head/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/history/react/setup.ts
  • benchmarks/client-nav/scenarios/history/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/react/src/main.tsx
  • benchmarks/client-nav/scenarios/history/shared.ts
  • benchmarks/client-nav/scenarios/history/solid/setup.ts
  • benchmarks/client-nav/scenarios/history/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/history/vue/setup.ts
  • benchmarks/client-nav/scenarios/history/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/links/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/react/src/main.tsx
  • benchmarks/client-nav/scenarios/links/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/links/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/react/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/react/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/react/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/react/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/shared.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/react/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/vue/src/main.tsx
  • benchmarks/ssr/bench-utils.test.ts
  • benchmarks/ssr/bench-utils.ts
  • benchmarks/ssr/package.json
  • benchmarks/ssr/scenarios/assets/shared.ts
  • benchmarks/ssr/scenarios/before-load/shared-bench.ts
  • benchmarks/ssr/scenarios/control-flow/shared.ts
  • benchmarks/ssr/scenarios/global-middleware/bench.ts
  • benchmarks/ssr/scenarios/head/shared.ts
  • benchmarks/ssr/scenarios/loaders/shared-bench.ts
  • benchmarks/ssr/scenarios/rewrites/shared.ts
  • benchmarks/ssr/scenarios/selective-ssr/shared-bench.ts
  • benchmarks/ssr/scenarios/serialization/shared-bench.ts
  • benchmarks/ssr/scenarios/server-fn-transport/bench.ts
  • benchmarks/ssr/scenarios/server-fns/bench.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/shared.ts
  • benchmarks/ssr/scenarios/server-routes/shared.ts
  • benchmarks/ssr/scenarios/streaming/shared-bench.ts
  • benchmarks/ssr/tsconfig.json
  • benchmarks/ssr/vitest.unit.config.ts

"test:types:vue": "tsc -p ./vue/tsconfig.json --noEmit"
},
"dependencies": {
"@tanstack/history": "workspace:^",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the required workspace protocol.

Replace workspace:^ with workspace:* for this internal dependency.

As per coding guidelines, "**/package.json: Use workspace protocol (workspace:*) for internal dependencies."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/package.json` at line 22, Update the `@tanstack/history`
dependency declaration in package.json to use the workspace:* protocol instead
of workspace:^, preserving it as an internal workspace dependency.

Source: Coding guidelines

Comment on lines 161 to +166
return () => {
window.setTimeout = originalSetTimeout as typeof window.setTimeout
window.clearTimeout = originalClearTimeout as typeof window.clearTimeout
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Cancel pending patched timers during teardown.

restoreTimeouts() restores the timer methods but leaves queued setImmediate callbacks active. A callback queued before after() can run after unmount, history destruction, or JSDOM window closure. Cancel and clear all tracked immediates before restoring the methods.

Proposed fix
 return () => {
+ for (const immediate of immediates.values()) {+ clearImmediate(immediate)+ }+ immediates.clear()
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return()=>{
window.setTimeout=originalSetTimeoutastypeofwindow.setTimeout
window.clearTimeout=originalClearTimeoutastypeofwindow.clearTimeout
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
return()=>{
for(constimmediateofimmediates.values()){
clearImmediate(immediate)
}
immediates.clear()
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/scenarios/harness.ts` around lines 161 - 166, Update
the teardown function returned by restoreTimeouts() to cancel every tracked
setImmediate callback and clear the tracking collection before restoring
targetWindow.setTimeout and targetWindow.clearTimeout. Ensure pending callbacks
cannot run after teardown, while preserving the existing timer-method
restoration.

@codspeed-hq

codspeed-hqBot commented Aug 6, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.86%

⚠️Different runtime environments detected

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

Open the report in CodSpeed to investigate

⚡ 28 improved benchmarks
❌ 80 (👁 80) regressed benchmarks
✅ 72 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths not-found (vue)943.8 KB319.2 KB×3
Memorymem server error-paths unmatched (react)440.3 KB273.3 KB+61.09%
Simulationclient-control-flow navigation loop (vue)55.5 ms35.7 ms+55.62%
Simulationclient-rewrites navigation loop (vue)68.1 ms48.1 ms+41.73%
Memorymem client unique-location-churn (solid)473.9 KB342.1 KB+38.52%
Simulationclient-async-pipeline navigation loop (vue)51.6 ms37.2 ms+38.48%
Simulationclient-search-params navigation loop (react)80.7 ms63.5 ms+27.09%
Simulationclient-search-params navigation loop (vue)95.1 ms80.4 ms+18.26%
Simulationclient-control-flow navigation loop (solid)65.7 ms56.3 ms+16.82%
Simulationclient-route-tree-scale navigation loop (vue)76.5 ms66.3 ms+15.41%
Simulationclient-nested-params navigation loop (solid)274.3 ms238.9 ms+14.82%
Simulationclient-search-params navigation loop (solid)131.5 ms115.3 ms+14.01%
Simulationclient-history navigation loop (vue)46.9 ms41.3 ms+13.57%
Simulationclient-head navigation loop (react)73.1 ms64.9 ms+12.77%
Simulationclient-rewrites navigation loop (react)50.6 ms45 ms+12.38%
Simulationclient-control-flow navigation loop (react)66 ms58.9 ms+12.14%
Simulationclient-rewrites navigation loop (solid)84.9 ms76.2 ms+11.31%
Simulationclient-route-tree-scale navigation loop (react)72.3 ms66.4 ms+8.84%
Simulationclient-route-tree-scale navigation loop (solid)131.1 ms120.4 ms+8.83%
Simulationclient-nested-params navigation loop (react)76.9 ms70.7 ms+8.72%
..................

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing test-stabilize-cpu-benchmarks (fe294d7) with main (ac1d0ab)

Open in CodSpeed

@Sheraff
Sheraff merged commit abf9b81 into mainAug 6, 2026
26 checks passed
@Sheraff
Sheraff deleted the test-stabilize-cpu-benchmarks branch August 6, 2026 14:46
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Sheraff
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

test: stabilize codspeed CPU benchmarks - #7987

Merged
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks
Aug 6, 2026
Merged

test: stabilize codspeed CPU benchmarks#7987
Sheraff merged 1 commit into
mainfrom
test-stabilize-cpu-benchmarks

Conversation

@Sheraff

@SheraffSheraff commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Benchmark Improvements
    • Improved client-navigation benchmarks with isolated state, consistent history handling, and more accurate batch completion across React, Solid, and Vue scenarios.
    • Updated SSR benchmarks to support controlled concurrent request workloads and clearer total-request measurement.
  • Bug Fixes
    • Improved request draining and failure handling so benchmark errors are reported reliably without leaving work unfinished.
  • Tests
    • Added comprehensive SSR utility coverage for concurrency limits, streaming responses, deterministic request distribution, and worker failures.
  • Chores
    • Added unit-test and type-checking targets for SSR benchmark validation.

@nx-cloud

nx-cloudBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit fe294d7

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded12m 2sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded1m 41sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-06 14:24:43 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

@coderabbitai

coderabbitaiBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates client-navigation benchmarks to use harness-managed history and per-invocation lifecycle handling. It also changes SSR benchmarks to deterministic concurrent request loops with explicit workload counts, validation tests, Vitest configuration, and TypeScript checking.

Changes

Client-navigation benchmark history

Layer / File(s)Summary
History-aware harness
benchmarks/client-nav/scenarios/harness.ts
The harness supports browser and memory history, timer patching, listener cleanup, deterministic batch settling, history disposal, and fresh mount-loop history.
History propagation
benchmarks/client-nav/scenarios/*/src/main.tsx, benchmarks/client-nav/scenarios/history/*, benchmarks/client-nav/scenarios/rewrites/*
Scenario adapters receive RouterHistory, pass it to routers, and use it for pathname assertions.
Benchmark lifecycle updates
benchmarks/client-nav/scenarios/*/speed.bench.ts, benchmarks/client-nav/package.json
Benchmarks use per-invocation hooks and explicit test.finishBatch(). The client-navigation workspace adds @tanstack/history and jsdom.

SSR benchmark concurrency

Layer / File(s)Summary
Concurrent request-loop engine
benchmarks/ssr/bench-utils.ts
runRequestLoop builds deterministic worker sequences, runs them concurrently, drains response bodies, validates inputs, and propagates settled failures.
Request-loop tests
benchmarks/ssr/bench-utils.test.ts
Unit tests cover concurrency limits, deterministic request assignment, streaming completion, and failure draining.
Scenario workload migration
benchmarks/ssr/scenarios/*
SSR scenarios replace iterations with totalRequests and configure concurrency of 16.
SSR test tooling
benchmarks/ssr/package.json, benchmarks/ssr/tsconfig.json, benchmarks/ssr/vitest.unit.config.ts
The package adds a Vitest unit-test target and enables no-emit TypeScript checking.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
participant Benchmark
participant ClientNavHarness
participant Router
participant History
Benchmark->>ClientNavHarness: create scenario state
ClientNavHarness->>History: create browser or memory history
ClientNavHarness->>Router: mount with RouterHistory
Benchmark->>Router: execute navigation ticks
Benchmark->>ClientNavHarness: finishBatch
ClientNavHarness->>History: dispose history and restore resources
Loading
sequenceDiagram
participant SSRBenchmark
participant runRequestLoop
participant RequestWorkers
participant SSRServer
SSRBenchmark->>runRequestLoop: provide concurrency and totalRequests
runRequestLoop->>RequestWorkers: build and distribute request sequences
RequestWorkers->>SSRServer: execute requests concurrently
SSRServer-->>RequestWorkers: return response bodies
RequestWorkers->>runRequestLoop: drain and validate responses
runRequestLoop-->>SSRBenchmark: resolve or reject after workers settle
Loading

Suggested labels:package: history, package: router-core

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 7.41% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly summarizes the main changes to stabilize CodSpeed CPU benchmarks across client-navigation and SSR benchmark suites.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test-stabilize-cpu-benchmarks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pkg-pr-new

pkg-pr-newBot commented Aug 6, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: fe294d7

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

This pull request does not affect bundle size in any measured scenario.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@benchmarks/client-nav/package.json`:
- Line 22: Update the `@tanstack/history` dependency declaration in package.json
to use the workspace:* protocol instead of workspace:^, preserving it as an
internal workspace dependency.
In `@benchmarks/client-nav/scenarios/harness.ts`:
- Around line 161-166: Update the teardown function returned by
restoreTimeouts() to cancel every tracked setImmediate callback and clear the
tracking collection before restoring targetWindow.setTimeout and
targetWindow.clearTimeout. Ensure pending callbacks cannot run after teardown,
while preserving the existing timer-method restoration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 78324e95-3e8b-4367-8d62-274084374bfb

📥 Commits

Reviewing files that changed from the base of the PR and between ac1d0ab and fe294d7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (98)
  • benchmarks/client-nav/package.json
  • benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/react/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/async-pipeline/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/react/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/control-flow/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/harness.ts
  • benchmarks/client-nav/scenarios/head/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/react/src/main.tsx
  • benchmarks/client-nav/scenarios/head/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/head/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/head/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/history/react/setup.ts
  • benchmarks/client-nav/scenarios/history/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/react/src/main.tsx
  • benchmarks/client-nav/scenarios/history/shared.ts
  • benchmarks/client-nav/scenarios/history/solid/setup.ts
  • benchmarks/client-nav/scenarios/history/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/history/vue/setup.ts
  • benchmarks/client-nav/scenarios/history/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/history/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/links/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/react/src/main.tsx
  • benchmarks/client-nav/scenarios/links/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/links/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/links/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/react/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/loaders/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/react/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/mount/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/nested-params/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/react/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/preload/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/react/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/shared.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/rewrites/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/react/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/route-tree-scale/vue/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/react/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx
  • benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts
  • benchmarks/client-nav/scenarios/search-params/vue/src/main.tsx
  • benchmarks/ssr/bench-utils.test.ts
  • benchmarks/ssr/bench-utils.ts
  • benchmarks/ssr/package.json
  • benchmarks/ssr/scenarios/assets/shared.ts
  • benchmarks/ssr/scenarios/before-load/shared-bench.ts
  • benchmarks/ssr/scenarios/control-flow/shared.ts
  • benchmarks/ssr/scenarios/global-middleware/bench.ts
  • benchmarks/ssr/scenarios/head/shared.ts
  • benchmarks/ssr/scenarios/loaders/shared-bench.ts
  • benchmarks/ssr/scenarios/rewrites/shared.ts
  • benchmarks/ssr/scenarios/selective-ssr/shared-bench.ts
  • benchmarks/ssr/scenarios/serialization/shared-bench.ts
  • benchmarks/ssr/scenarios/server-fn-transport/bench.ts
  • benchmarks/ssr/scenarios/server-fns/bench.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/shared.ts
  • benchmarks/ssr/scenarios/server-routes/shared.ts
  • benchmarks/ssr/scenarios/streaming/shared-bench.ts
  • benchmarks/ssr/tsconfig.json
  • benchmarks/ssr/vitest.unit.config.ts

"test:types:vue": "tsc -p ./vue/tsconfig.json --noEmit"
},
"dependencies": {
"@tanstack/history": "workspace:^",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the required workspace protocol.

Replace workspace:^ with workspace:* for this internal dependency.

As per coding guidelines, "**/package.json: Use workspace protocol (workspace:*) for internal dependencies."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/package.json` at line 22, Update the `@tanstack/history`
dependency declaration in package.json to use the workspace:* protocol instead
of workspace:^, preserving it as an internal workspace dependency.

Source: Coding guidelines

Comment on lines 161 to +166
return () => {
window.setTimeout = originalSetTimeout as typeof window.setTimeout
window.clearTimeout = originalClearTimeout as typeof window.clearTimeout
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Cancel pending patched timers during teardown.

restoreTimeouts() restores the timer methods but leaves queued setImmediate callbacks active. A callback queued before after() can run after unmount, history destruction, or JSDOM window closure. Cancel and clear all tracked immediates before restoring the methods.

Proposed fix
 return () => {
+ for (const immediate of immediates.values()) {+ clearImmediate(immediate)+ }+ immediates.clear()
targetWindow.setTimeout =
originalSetTimeout as typeof targetWindow.setTimeout
targetWindow.clearTimeout =
originalClearTimeout as typeof targetWindow.clearTimeout
}
📝 Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return()=>{
window.setTimeout=originalSetTimeoutastypeofwindow.setTimeout
window.clearTimeout=originalClearTimeoutastypeofwindow.clearTimeout
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
return()=>{
for(constimmediateofimmediates.values()){
clearImmediate(immediate)
}
immediates.clear()
targetWindow.setTimeout=
originalSetTimeoutastypeoftargetWindow.setTimeout
targetWindow.clearTimeout=
originalClearTimeoutastypeoftargetWindow.clearTimeout
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@benchmarks/client-nav/scenarios/harness.ts` around lines 161 - 166, Update
the teardown function returned by restoreTimeouts() to cancel every tracked
setImmediate callback and clear the tracking collection before restoring
targetWindow.setTimeout and targetWindow.clearTimeout. Ensure pending callbacks
cannot run after teardown, while preserving the existing timer-method
restoration.

@codspeed-hq

codspeed-hqBot commented Aug 6, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.86%

⚠️Different runtime environments detected

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

Open the report in CodSpeed to investigate

⚡ 28 improved benchmarks
❌ 80 (👁 80) regressed benchmarks
✅ 72 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths not-found (vue)943.8 KB319.2 KB×3
Memorymem server error-paths unmatched (react)440.3 KB273.3 KB+61.09%
Simulationclient-control-flow navigation loop (vue)55.5 ms35.7 ms+55.62%
Simulationclient-rewrites navigation loop (vue)68.1 ms48.1 ms+41.73%
Memorymem client unique-location-churn (solid)473.9 KB342.1 KB+38.52%
Simulationclient-async-pipeline navigation loop (vue)51.6 ms37.2 ms+38.48%
Simulationclient-search-params navigation loop (react)80.7 ms63.5 ms+27.09%
Simulationclient-search-params navigation loop (vue)95.1 ms80.4 ms+18.26%
Simulationclient-control-flow navigation loop (solid)65.7 ms56.3 ms+16.82%
Simulationclient-route-tree-scale navigation loop (vue)76.5 ms66.3 ms+15.41%
Simulationclient-nested-params navigation loop (solid)274.3 ms238.9 ms+14.82%
Simulationclient-search-params navigation loop (solid)131.5 ms115.3 ms+14.01%
Simulationclient-history navigation loop (vue)46.9 ms41.3 ms+13.57%
Simulationclient-head navigation loop (react)73.1 ms64.9 ms+12.77%
Simulationclient-rewrites navigation loop (react)50.6 ms45 ms+12.38%
Simulationclient-control-flow navigation loop (react)66 ms58.9 ms+12.14%
Simulationclient-rewrites navigation loop (solid)84.9 ms76.2 ms+11.31%
Simulationclient-route-tree-scale navigation loop (react)72.3 ms66.4 ms+8.84%
Simulationclient-route-tree-scale navigation loop (solid)131.1 ms120.4 ms+8.83%
Simulationclient-nested-params navigation loop (react)76.9 ms70.7 ms+8.72%
..................

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing test-stabilize-cpu-benchmarks (fe294d7) with main (ac1d0ab)

Open in CodSpeed

@Sheraff
Sheraff merged commit abf9b81 into mainAug 6, 2026
26 checks passed
@Sheraff
Sheraff deleted the test-stabilize-cpu-benchmarks branch August 6, 2026 14:46
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Sheraff