perf(router-core): skip impossible JSON parse attempts - #8006

Merged
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse
Aug 8, 2026
Merged

perf(router-core): skip impossible JSON parse attempts#8006
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse

Conversation

@Sheraff

@SheraffSheraff commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • avoid calling JSON.parse when a string's first character cannot begin valid JSON
  • apply the shortcut only when the configured parser is exactly JSON.parse
  • preserve custom parser behavior and all valid JSON prefixes, including whitespace, quotes, numbers, literals, arrays, and objects
  • add correctness cases and a focused benchmark covering expected and unfavorable distributions

Why

The default search serializer probes every string with JSON.parse so JSON-looking strings remain strings after a round trip. Ordinary application strings usually fail that probe, making exception creation and handling the dominant cost. The grammar check avoids only parses that are guaranteed to fail.

Impact

Focused local benchmarks, each serializing 1,000 objects:

  • ordinary strings: 15.694 ms to 4.571 ms (about 70.9% faster)
  • mixed application values: 4.669 ms to 0.482 ms (about 89.7% faster)
  • JSON-compatible strings remain on the parse path (0.863 ms in the latest control run)
  • strings beginning with JSON literal prefixes remain an intentionally unfavorable control (17.122 ms)

react-router.minimal changes from 85,919 to 85,956 bytes gzip (+37 bytes).

Validation

  • @tanstack/router-core:test:unit: 105 files / 1,547 tests passed, plus 3 expected failures
  • @tanstack/router-core:test:types: TypeScript 5.6 through 7.0 passed
  • @tanstack/router-core:test:eslint: zero errors (existing warnings remain)
  • focused tests/searchParams.bench.ts run
  • react-router.minimal bundle-size scenario on main and this branch
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes

    • Improved search-parameter serialization by skipping unnecessary JSON parsing for strings that cannot contain valid JSON.
    • Preserved correct handling of JSON-compatible values, empty strings, punctuation, and custom parsers.
  • Performance

    • Reduced avoidable parsing work during query-string serialization.
  • Tests

    • Expanded coverage for serialization edge cases.
    • Added benchmarks for representative search-parameter scenarios.

@coderabbitai

coderabbitaiBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ce06239-1eef-4f84-9e31-3c0ad504f4c5

📥 Commits

Reviewing files that changed from the base of the PR and between c568caf and e86a0d5.

📒 Files selected for processing (4)
  • .changeset/dirty-bushes-sink.md
  • packages/router-core/src/searchParams.ts
  • packages/router-core/tests/searchParams.bench.ts
  • packages/router-core/tests/searchParams.test.ts

📝 Walkthrough

Walkthrough

The search parameter serializer now avoids impossible JSON.parse calls by checking string prefixes. Tests and benchmarks cover default serialization, custom parsers, JSON-compatible strings, and edge cases. A patch changeset documents the router-core update.

Changes

Search serialization

Layer / File(s)Summary
Guard JSON parsing
packages/router-core/src/searchParams.ts
stringifyValue checks jsonStart and the exact JSON.parse function before parsing string values.
Validate serialization behavior
packages/router-core/tests/searchParams.test.ts, packages/router-core/tests/searchParams.bench.ts, .changeset/dirty-bushes-sink.md
Tests and benchmarks cover ordinary values, JSON-compatible strings, custom parsers, punctuation, empty strings, and mixed values. The changeset marks a patch release.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
participant stringifySearchWith
participant stringifyValue
participant JSON.parse
stringifySearchWith->>stringifyValue: serialize search value
stringifyValue->>stringifyValue: check jsonStart
stringifyValue->>JSON.parse: parse eligible string
JSON.parse-->>stringifyValue: parsed value
stringifyValue-->>stringifySearchWith: serialized value
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and concisely describes the main optimization: skipping impossible JSON parse attempts in router-core.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/search-params-skip-json-parse

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.

@nx-cloud

nx-cloudBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit e86a0d5

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded5m 19sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded23sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-08 17:21:40 UTC

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

1 package(s) bumped directly, 22 bumped as dependents.

🟩 Patch bumps

PackageVersionReason
@tanstack/router-core1.171.19 → 1.171.20Changeset
@tanstack/react-router1.170.23 → 1.170.24Dependent
@tanstack/react-start1.168.40 → 1.168.41Dependent
@tanstack/react-start-client1.168.21 → 1.168.22Dependent
@tanstack/react-start-rsc0.1.39 → 0.1.40Dependent
@tanstack/react-start-server1.167.28 → 1.167.29Dependent
@tanstack/router-cli1.167.25 → 1.167.26Dependent
@tanstack/router-generator1.167.25 → 1.167.26Dependent
@tanstack/router-plugin1.168.27 → 1.168.28Dependent
@tanstack/router-vite-plugin1.167.27 → 1.167.28Dependent
@tanstack/solid-router1.170.22 → 1.170.23Dependent
@tanstack/solid-start1.168.39 → 1.168.40Dependent
@tanstack/solid-start-client1.168.21 → 1.168.22Dependent
@tanstack/solid-start-server1.167.28 → 1.167.29Dependent
@tanstack/start-client-core1.170.19 → 1.170.20Dependent
@tanstack/start-plugin-core1.171.31 → 1.171.32Dependent
@tanstack/start-server-core1.169.23 → 1.169.24Dependent
@tanstack/start-static-server-functions1.167.24 → 1.167.25Dependent
@tanstack/start-storage-context1.167.21 → 1.167.22Dependent
@tanstack/vue-router1.170.21 → 1.170.22Dependent
@tanstack/vue-start1.168.38 → 1.168.39Dependent
@tanstack/vue-start-client1.167.24 → 1.167.25Dependent
@tanstack/vue-start-server1.167.28 → 1.167.29Dependent

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: efb9dfc55201
  • Measured at: 2026-08-08T17:17:34.467Z
  • Baseline source: history:c568caf3f376
  • Dashboard: bundle-size history

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

ScenarioCurrent (gzip)Delta vs baselineInitial gzipRawBrotliTrend
react-router.minimal83.92 KiB+17 B (+0.02%)83.78 KiB262.67 KiB72.99 KiB█████████▁▁▁
react-router.full87.43 KiB+34 B (+0.04%)87.29 KiB274.39 KiB76.15 KiB█████████▁▁▁
solid-router.minimal33.24 KiB+25 B (+0.07%)33.12 KiB96.51 KiB29.94 KiB█████████▁▁▁
solid-router.full38.07 KiB+27 B (+0.07%)37.95 KiB111.14 KiB34.25 KiB█████████▁▁▁
vue-router.minimal49.53 KiB+36 B (+0.07%)49.41 KiB138.25 KiB44.68 KiB█████████▁▁▁
vue-router.full55.11 KiB+39 B (+0.07%)54.99 KiB156.43 KiB49.59 KiB█████████▁▁▁
react-start.minimal96.70 KiB+41 B (+0.04%)96.57 KiB304.83 KiB83.82 KiB█████████▁▁▁
react-start.deferred-hydration97.44 KiB+51 B (+0.05%)96.59 KiB306.19 KiB84.42 KiB█████████▁▁▁
react-start.full99.88 KiB+50 B (+0.05%)99.75 KiB314.55 KiB86.52 KiB█████████▁▁▁
react-start.rsbuild.minimal100.02 KiB+25 B (+0.02%)99.85 KiB315.37 KiB86.20 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.minimal-iife100.42 KiB+22 B (+0.02%)100.26 KiB316.31 KiB86.58 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.full103.35 KiB+34 B (+0.03%)103.17 KiB325.46 KiB88.99 KiB▁▁▁▅▅▄▄▆▆▆▆█
solid-start.minimal45.97 KiB+31 B (+0.07%)45.85 KiB137.51 KiB40.93 KiB█████████▁▁▁
solid-start.deferred-hydration49.04 KiB+37 B (+0.07%)45.90 KiB144.97 KiB43.65 KiB█████████▁▁▁
solid-start.full51.05 KiB+37 B (+0.07%)50.93 KiB152.90 KiB45.29 KiB█████████▁▁▁
vue-start.minimal65.52 KiB+31 B (+0.05%)65.39 KiB189.02 KiB58.38 KiB█████████▁▁▁
vue-start.full69.34 KiB+55 B (+0.08%)69.21 KiB201.30 KiB61.58 KiB█████████▁▁▁

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@pkg-pr-new

pkg-pr-newBot commented Aug 8, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: e86a0d5

@codspeed-hq

codspeed-hqBot commented Aug 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 0.36%

⚠️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

⚡ 23 improved benchmarks
❌ 7 (👁 7) regressed benchmarks
✅ 150 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths redirect (solid)588.2 KB288.5 KB×2
Simulationssr request loop (react)80 ms51.8 ms+54.26%
Simulationclient-search-params navigation loop (react)59.4 ms47.1 ms+26.14%
Simulationssr rewrite localized (react)89 ms75.3 ms+18.2%
Simulationclient-search-params navigation loop (vue)80.5 ms68.4 ms+17.63%
Simulationclient-links navigation loop (react)90.6 ms77.2 ms+17.41%
Simulationclient-search-params navigation loop (solid)114.8 ms99.9 ms+14.93%
Simulationssr request loop (solid)158 ms144.4 ms+9.41%
Simulationssr rewrite passthrough (react)114.1 ms104.6 ms+9.08%
Simulationclient-links navigation loop (vue)163.9 ms150.5 ms+8.92%
Simulationssr rewrite localized (solid)126.6 ms117 ms+8.17%
Simulationclient-side navigation loop (react)41.2 ms38.1 ms+8.05%
Simulationssr request loop (vue)270.2 ms254.9 ms+6%
Memorymem client preload-churn (vue)776.2 KB735.3 KB+5.57%
Simulationclient-rewrites navigation loop (react)44.6 ms42.4 ms+5.21%
Simulationclient-rewrites navigation loop (vue)48.1 ms45.9 ms+4.77%
Simulationclient-side navigation loop (vue)70.1 ms67 ms+4.6%
Simulationclient-side navigation loop (solid)88 ms84.4 ms+4.26%
Simulationssr rewrite localized (vue)214.6 ms206.9 ms+3.74%
Memorymem server serialization-payload (solid)3.5 MB3.4 MB+3.51%
..................

ℹ️ 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 agent/search-params-skip-json-parse (e86a0d5) with main (c568caf)

Open in CodSpeed

@Sheraff
Sheraff marked this pull request as ready for review August 8, 2026 17:14
@Sheraff
Sheraff merged commit 44a8c3e into mainAug 8, 2026
26 checks passed
@Sheraff
Sheraff deleted the agent/search-params-skip-json-parse branch August 8, 2026 17:43
@github-actionsgithub-actionsBot mentioned this pull request Aug 8, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Sheraff
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 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

perf(router-core): skip impossible JSON parse attempts - #8006

Merged
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse
Aug 8, 2026
Merged

perf(router-core): skip impossible JSON parse attempts#8006
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse

Conversation

@Sheraff

@SheraffSheraff commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • avoid calling JSON.parse when a string's first character cannot begin valid JSON
  • apply the shortcut only when the configured parser is exactly JSON.parse
  • preserve custom parser behavior and all valid JSON prefixes, including whitespace, quotes, numbers, literals, arrays, and objects
  • add correctness cases and a focused benchmark covering expected and unfavorable distributions

Why

The default search serializer probes every string with JSON.parse so JSON-looking strings remain strings after a round trip. Ordinary application strings usually fail that probe, making exception creation and handling the dominant cost. The grammar check avoids only parses that are guaranteed to fail.

Impact

Focused local benchmarks, each serializing 1,000 objects:

  • ordinary strings: 15.694 ms to 4.571 ms (about 70.9% faster)
  • mixed application values: 4.669 ms to 0.482 ms (about 89.7% faster)
  • JSON-compatible strings remain on the parse path (0.863 ms in the latest control run)
  • strings beginning with JSON literal prefixes remain an intentionally unfavorable control (17.122 ms)

react-router.minimal changes from 85,919 to 85,956 bytes gzip (+37 bytes).

Validation

  • @tanstack/router-core:test:unit: 105 files / 1,547 tests passed, plus 3 expected failures
  • @tanstack/router-core:test:types: TypeScript 5.6 through 7.0 passed
  • @tanstack/router-core:test:eslint: zero errors (existing warnings remain)
  • focused tests/searchParams.bench.ts run
  • react-router.minimal bundle-size scenario on main and this branch
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes

    • Improved search-parameter serialization by skipping unnecessary JSON parsing for strings that cannot contain valid JSON.
    • Preserved correct handling of JSON-compatible values, empty strings, punctuation, and custom parsers.
  • Performance

    • Reduced avoidable parsing work during query-string serialization.
  • Tests

    • Expanded coverage for serialization edge cases.
    • Added benchmarks for representative search-parameter scenarios.

@coderabbitai

coderabbitaiBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ce06239-1eef-4f84-9e31-3c0ad504f4c5

📥 Commits

Reviewing files that changed from the base of the PR and between c568caf and e86a0d5.

📒 Files selected for processing (4)
  • .changeset/dirty-bushes-sink.md
  • packages/router-core/src/searchParams.ts
  • packages/router-core/tests/searchParams.bench.ts
  • packages/router-core/tests/searchParams.test.ts

📝 Walkthrough

Walkthrough

The search parameter serializer now avoids impossible JSON.parse calls by checking string prefixes. Tests and benchmarks cover default serialization, custom parsers, JSON-compatible strings, and edge cases. A patch changeset documents the router-core update.

Changes

Search serialization

Layer / File(s)Summary
Guard JSON parsing
packages/router-core/src/searchParams.ts
stringifyValue checks jsonStart and the exact JSON.parse function before parsing string values.
Validate serialization behavior
packages/router-core/tests/searchParams.test.ts, packages/router-core/tests/searchParams.bench.ts, .changeset/dirty-bushes-sink.md
Tests and benchmarks cover ordinary values, JSON-compatible strings, custom parsers, punctuation, empty strings, and mixed values. The changeset marks a patch release.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
participant stringifySearchWith
participant stringifyValue
participant JSON.parse
stringifySearchWith->>stringifyValue: serialize search value
stringifyValue->>stringifyValue: check jsonStart
stringifyValue->>JSON.parse: parse eligible string
JSON.parse-->>stringifyValue: parsed value
stringifyValue-->>stringifySearchWith: serialized value
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and concisely describes the main optimization: skipping impossible JSON parse attempts in router-core.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/search-params-skip-json-parse

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.

@nx-cloud

nx-cloudBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit e86a0d5

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded5m 19sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded23sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-08 17:21:40 UTC

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

1 package(s) bumped directly, 22 bumped as dependents.

🟩 Patch bumps

PackageVersionReason
@tanstack/router-core1.171.19 → 1.171.20Changeset
@tanstack/react-router1.170.23 → 1.170.24Dependent
@tanstack/react-start1.168.40 → 1.168.41Dependent
@tanstack/react-start-client1.168.21 → 1.168.22Dependent
@tanstack/react-start-rsc0.1.39 → 0.1.40Dependent
@tanstack/react-start-server1.167.28 → 1.167.29Dependent
@tanstack/router-cli1.167.25 → 1.167.26Dependent
@tanstack/router-generator1.167.25 → 1.167.26Dependent
@tanstack/router-plugin1.168.27 → 1.168.28Dependent
@tanstack/router-vite-plugin1.167.27 → 1.167.28Dependent
@tanstack/solid-router1.170.22 → 1.170.23Dependent
@tanstack/solid-start1.168.39 → 1.168.40Dependent
@tanstack/solid-start-client1.168.21 → 1.168.22Dependent
@tanstack/solid-start-server1.167.28 → 1.167.29Dependent
@tanstack/start-client-core1.170.19 → 1.170.20Dependent
@tanstack/start-plugin-core1.171.31 → 1.171.32Dependent
@tanstack/start-server-core1.169.23 → 1.169.24Dependent
@tanstack/start-static-server-functions1.167.24 → 1.167.25Dependent
@tanstack/start-storage-context1.167.21 → 1.167.22Dependent
@tanstack/vue-router1.170.21 → 1.170.22Dependent
@tanstack/vue-start1.168.38 → 1.168.39Dependent
@tanstack/vue-start-client1.167.24 → 1.167.25Dependent
@tanstack/vue-start-server1.167.28 → 1.167.29Dependent

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: efb9dfc55201
  • Measured at: 2026-08-08T17:17:34.467Z
  • Baseline source: history:c568caf3f376
  • Dashboard: bundle-size history

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

ScenarioCurrent (gzip)Delta vs baselineInitial gzipRawBrotliTrend
react-router.minimal83.92 KiB+17 B (+0.02%)83.78 KiB262.67 KiB72.99 KiB█████████▁▁▁
react-router.full87.43 KiB+34 B (+0.04%)87.29 KiB274.39 KiB76.15 KiB█████████▁▁▁
solid-router.minimal33.24 KiB+25 B (+0.07%)33.12 KiB96.51 KiB29.94 KiB█████████▁▁▁
solid-router.full38.07 KiB+27 B (+0.07%)37.95 KiB111.14 KiB34.25 KiB█████████▁▁▁
vue-router.minimal49.53 KiB+36 B (+0.07%)49.41 KiB138.25 KiB44.68 KiB█████████▁▁▁
vue-router.full55.11 KiB+39 B (+0.07%)54.99 KiB156.43 KiB49.59 KiB█████████▁▁▁
react-start.minimal96.70 KiB+41 B (+0.04%)96.57 KiB304.83 KiB83.82 KiB█████████▁▁▁
react-start.deferred-hydration97.44 KiB+51 B (+0.05%)96.59 KiB306.19 KiB84.42 KiB█████████▁▁▁
react-start.full99.88 KiB+50 B (+0.05%)99.75 KiB314.55 KiB86.52 KiB█████████▁▁▁
react-start.rsbuild.minimal100.02 KiB+25 B (+0.02%)99.85 KiB315.37 KiB86.20 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.minimal-iife100.42 KiB+22 B (+0.02%)100.26 KiB316.31 KiB86.58 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.full103.35 KiB+34 B (+0.03%)103.17 KiB325.46 KiB88.99 KiB▁▁▁▅▅▄▄▆▆▆▆█
solid-start.minimal45.97 KiB+31 B (+0.07%)45.85 KiB137.51 KiB40.93 KiB█████████▁▁▁
solid-start.deferred-hydration49.04 KiB+37 B (+0.07%)45.90 KiB144.97 KiB43.65 KiB█████████▁▁▁
solid-start.full51.05 KiB+37 B (+0.07%)50.93 KiB152.90 KiB45.29 KiB█████████▁▁▁
vue-start.minimal65.52 KiB+31 B (+0.05%)65.39 KiB189.02 KiB58.38 KiB█████████▁▁▁
vue-start.full69.34 KiB+55 B (+0.08%)69.21 KiB201.30 KiB61.58 KiB█████████▁▁▁

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@pkg-pr-new

pkg-pr-newBot commented Aug 8, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: e86a0d5

@codspeed-hq

codspeed-hqBot commented Aug 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 0.36%

⚠️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

⚡ 23 improved benchmarks
❌ 7 (👁 7) regressed benchmarks
✅ 150 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths redirect (solid)588.2 KB288.5 KB×2
Simulationssr request loop (react)80 ms51.8 ms+54.26%
Simulationclient-search-params navigation loop (react)59.4 ms47.1 ms+26.14%
Simulationssr rewrite localized (react)89 ms75.3 ms+18.2%
Simulationclient-search-params navigation loop (vue)80.5 ms68.4 ms+17.63%
Simulationclient-links navigation loop (react)90.6 ms77.2 ms+17.41%
Simulationclient-search-params navigation loop (solid)114.8 ms99.9 ms+14.93%
Simulationssr request loop (solid)158 ms144.4 ms+9.41%
Simulationssr rewrite passthrough (react)114.1 ms104.6 ms+9.08%
Simulationclient-links navigation loop (vue)163.9 ms150.5 ms+8.92%
Simulationssr rewrite localized (solid)126.6 ms117 ms+8.17%
Simulationclient-side navigation loop (react)41.2 ms38.1 ms+8.05%
Simulationssr request loop (vue)270.2 ms254.9 ms+6%
Memorymem client preload-churn (vue)776.2 KB735.3 KB+5.57%
Simulationclient-rewrites navigation loop (react)44.6 ms42.4 ms+5.21%
Simulationclient-rewrites navigation loop (vue)48.1 ms45.9 ms+4.77%
Simulationclient-side navigation loop (vue)70.1 ms67 ms+4.6%
Simulationclient-side navigation loop (solid)88 ms84.4 ms+4.26%
Simulationssr rewrite localized (vue)214.6 ms206.9 ms+3.74%
Memorymem server serialization-payload (solid)3.5 MB3.4 MB+3.51%
..................

ℹ️ 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 agent/search-params-skip-json-parse (e86a0d5) with main (c568caf)

Open in CodSpeed

@Sheraff
Sheraff marked this pull request as ready for review August 8, 2026 17:14
@Sheraff
Sheraff merged commit 44a8c3e into mainAug 8, 2026
26 checks passed
@Sheraff
Sheraff deleted the agent/search-params-skip-json-parse branch August 8, 2026 17:43
@github-actionsgithub-actionsBot mentioned this pull request Aug 8, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@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

perf(router-core): skip impossible JSON parse attempts - #8006

Merged
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse
Aug 8, 2026
Merged

perf(router-core): skip impossible JSON parse attempts#8006
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse

Conversation

@Sheraff

@SheraffSheraff commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • avoid calling JSON.parse when a string's first character cannot begin valid JSON
  • apply the shortcut only when the configured parser is exactly JSON.parse
  • preserve custom parser behavior and all valid JSON prefixes, including whitespace, quotes, numbers, literals, arrays, and objects
  • add correctness cases and a focused benchmark covering expected and unfavorable distributions

Why

The default search serializer probes every string with JSON.parse so JSON-looking strings remain strings after a round trip. Ordinary application strings usually fail that probe, making exception creation and handling the dominant cost. The grammar check avoids only parses that are guaranteed to fail.

Impact

Focused local benchmarks, each serializing 1,000 objects:

  • ordinary strings: 15.694 ms to 4.571 ms (about 70.9% faster)
  • mixed application values: 4.669 ms to 0.482 ms (about 89.7% faster)
  • JSON-compatible strings remain on the parse path (0.863 ms in the latest control run)
  • strings beginning with JSON literal prefixes remain an intentionally unfavorable control (17.122 ms)

react-router.minimal changes from 85,919 to 85,956 bytes gzip (+37 bytes).

Validation

  • @tanstack/router-core:test:unit: 105 files / 1,547 tests passed, plus 3 expected failures
  • @tanstack/router-core:test:types: TypeScript 5.6 through 7.0 passed
  • @tanstack/router-core:test:eslint: zero errors (existing warnings remain)
  • focused tests/searchParams.bench.ts run
  • react-router.minimal bundle-size scenario on main and this branch
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes

    • Improved search-parameter serialization by skipping unnecessary JSON parsing for strings that cannot contain valid JSON.
    • Preserved correct handling of JSON-compatible values, empty strings, punctuation, and custom parsers.
  • Performance

    • Reduced avoidable parsing work during query-string serialization.
  • Tests

    • Expanded coverage for serialization edge cases.
    • Added benchmarks for representative search-parameter scenarios.

@coderabbitai

coderabbitaiBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ce06239-1eef-4f84-9e31-3c0ad504f4c5

📥 Commits

Reviewing files that changed from the base of the PR and between c568caf and e86a0d5.

📒 Files selected for processing (4)
  • .changeset/dirty-bushes-sink.md
  • packages/router-core/src/searchParams.ts
  • packages/router-core/tests/searchParams.bench.ts
  • packages/router-core/tests/searchParams.test.ts

📝 Walkthrough

Walkthrough

The search parameter serializer now avoids impossible JSON.parse calls by checking string prefixes. Tests and benchmarks cover default serialization, custom parsers, JSON-compatible strings, and edge cases. A patch changeset documents the router-core update.

Changes

Search serialization

Layer / File(s)Summary
Guard JSON parsing
packages/router-core/src/searchParams.ts
stringifyValue checks jsonStart and the exact JSON.parse function before parsing string values.
Validate serialization behavior
packages/router-core/tests/searchParams.test.ts, packages/router-core/tests/searchParams.bench.ts, .changeset/dirty-bushes-sink.md
Tests and benchmarks cover ordinary values, JSON-compatible strings, custom parsers, punctuation, empty strings, and mixed values. The changeset marks a patch release.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
participant stringifySearchWith
participant stringifyValue
participant JSON.parse
stringifySearchWith->>stringifyValue: serialize search value
stringifyValue->>stringifyValue: check jsonStart
stringifyValue->>JSON.parse: parse eligible string
JSON.parse-->>stringifyValue: parsed value
stringifyValue-->>stringifySearchWith: serialized value
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and concisely describes the main optimization: skipping impossible JSON parse attempts in router-core.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/search-params-skip-json-parse

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.

@nx-cloud

nx-cloudBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit e86a0d5

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded5m 19sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded23sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-08 17:21:40 UTC

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

1 package(s) bumped directly, 22 bumped as dependents.

🟩 Patch bumps

PackageVersionReason
@tanstack/router-core1.171.19 → 1.171.20Changeset
@tanstack/react-router1.170.23 → 1.170.24Dependent
@tanstack/react-start1.168.40 → 1.168.41Dependent
@tanstack/react-start-client1.168.21 → 1.168.22Dependent
@tanstack/react-start-rsc0.1.39 → 0.1.40Dependent
@tanstack/react-start-server1.167.28 → 1.167.29Dependent
@tanstack/router-cli1.167.25 → 1.167.26Dependent
@tanstack/router-generator1.167.25 → 1.167.26Dependent
@tanstack/router-plugin1.168.27 → 1.168.28Dependent
@tanstack/router-vite-plugin1.167.27 → 1.167.28Dependent
@tanstack/solid-router1.170.22 → 1.170.23Dependent
@tanstack/solid-start1.168.39 → 1.168.40Dependent
@tanstack/solid-start-client1.168.21 → 1.168.22Dependent
@tanstack/solid-start-server1.167.28 → 1.167.29Dependent
@tanstack/start-client-core1.170.19 → 1.170.20Dependent
@tanstack/start-plugin-core1.171.31 → 1.171.32Dependent
@tanstack/start-server-core1.169.23 → 1.169.24Dependent
@tanstack/start-static-server-functions1.167.24 → 1.167.25Dependent
@tanstack/start-storage-context1.167.21 → 1.167.22Dependent
@tanstack/vue-router1.170.21 → 1.170.22Dependent
@tanstack/vue-start1.168.38 → 1.168.39Dependent
@tanstack/vue-start-client1.167.24 → 1.167.25Dependent
@tanstack/vue-start-server1.167.28 → 1.167.29Dependent

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: efb9dfc55201
  • Measured at: 2026-08-08T17:17:34.467Z
  • Baseline source: history:c568caf3f376
  • Dashboard: bundle-size history

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

ScenarioCurrent (gzip)Delta vs baselineInitial gzipRawBrotliTrend
react-router.minimal83.92 KiB+17 B (+0.02%)83.78 KiB262.67 KiB72.99 KiB█████████▁▁▁
react-router.full87.43 KiB+34 B (+0.04%)87.29 KiB274.39 KiB76.15 KiB█████████▁▁▁
solid-router.minimal33.24 KiB+25 B (+0.07%)33.12 KiB96.51 KiB29.94 KiB█████████▁▁▁
solid-router.full38.07 KiB+27 B (+0.07%)37.95 KiB111.14 KiB34.25 KiB█████████▁▁▁
vue-router.minimal49.53 KiB+36 B (+0.07%)49.41 KiB138.25 KiB44.68 KiB█████████▁▁▁
vue-router.full55.11 KiB+39 B (+0.07%)54.99 KiB156.43 KiB49.59 KiB█████████▁▁▁
react-start.minimal96.70 KiB+41 B (+0.04%)96.57 KiB304.83 KiB83.82 KiB█████████▁▁▁
react-start.deferred-hydration97.44 KiB+51 B (+0.05%)96.59 KiB306.19 KiB84.42 KiB█████████▁▁▁
react-start.full99.88 KiB+50 B (+0.05%)99.75 KiB314.55 KiB86.52 KiB█████████▁▁▁
react-start.rsbuild.minimal100.02 KiB+25 B (+0.02%)99.85 KiB315.37 KiB86.20 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.minimal-iife100.42 KiB+22 B (+0.02%)100.26 KiB316.31 KiB86.58 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.full103.35 KiB+34 B (+0.03%)103.17 KiB325.46 KiB88.99 KiB▁▁▁▅▅▄▄▆▆▆▆█
solid-start.minimal45.97 KiB+31 B (+0.07%)45.85 KiB137.51 KiB40.93 KiB█████████▁▁▁
solid-start.deferred-hydration49.04 KiB+37 B (+0.07%)45.90 KiB144.97 KiB43.65 KiB█████████▁▁▁
solid-start.full51.05 KiB+37 B (+0.07%)50.93 KiB152.90 KiB45.29 KiB█████████▁▁▁
vue-start.minimal65.52 KiB+31 B (+0.05%)65.39 KiB189.02 KiB58.38 KiB█████████▁▁▁
vue-start.full69.34 KiB+55 B (+0.08%)69.21 KiB201.30 KiB61.58 KiB█████████▁▁▁

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@pkg-pr-new

pkg-pr-newBot commented Aug 8, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: e86a0d5

@codspeed-hq

codspeed-hqBot commented Aug 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 0.36%

⚠️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

⚡ 23 improved benchmarks
❌ 7 (👁 7) regressed benchmarks
✅ 150 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths redirect (solid)588.2 KB288.5 KB×2
Simulationssr request loop (react)80 ms51.8 ms+54.26%
Simulationclient-search-params navigation loop (react)59.4 ms47.1 ms+26.14%
Simulationssr rewrite localized (react)89 ms75.3 ms+18.2%
Simulationclient-search-params navigation loop (vue)80.5 ms68.4 ms+17.63%
Simulationclient-links navigation loop (react)90.6 ms77.2 ms+17.41%
Simulationclient-search-params navigation loop (solid)114.8 ms99.9 ms+14.93%
Simulationssr request loop (solid)158 ms144.4 ms+9.41%
Simulationssr rewrite passthrough (react)114.1 ms104.6 ms+9.08%
Simulationclient-links navigation loop (vue)163.9 ms150.5 ms+8.92%
Simulationssr rewrite localized (solid)126.6 ms117 ms+8.17%
Simulationclient-side navigation loop (react)41.2 ms38.1 ms+8.05%
Simulationssr request loop (vue)270.2 ms254.9 ms+6%
Memorymem client preload-churn (vue)776.2 KB735.3 KB+5.57%
Simulationclient-rewrites navigation loop (react)44.6 ms42.4 ms+5.21%
Simulationclient-rewrites navigation loop (vue)48.1 ms45.9 ms+4.77%
Simulationclient-side navigation loop (vue)70.1 ms67 ms+4.6%
Simulationclient-side navigation loop (solid)88 ms84.4 ms+4.26%
Simulationssr rewrite localized (vue)214.6 ms206.9 ms+3.74%
Memorymem server serialization-payload (solid)3.5 MB3.4 MB+3.51%
..................

ℹ️ 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 agent/search-params-skip-json-parse (e86a0d5) with main (c568caf)

Open in CodSpeed

@Sheraff
Sheraff marked this pull request as ready for review August 8, 2026 17:14
@Sheraff
Sheraff merged commit 44a8c3e into mainAug 8, 2026
26 checks passed
@Sheraff
Sheraff deleted the agent/search-params-skip-json-parse branch August 8, 2026 17:43
@github-actionsgithub-actionsBot mentioned this pull request Aug 8, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@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 > 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

perf(router-core): skip impossible JSON parse attempts - #8006

Merged
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse
Aug 8, 2026
Merged

perf(router-core): skip impossible JSON parse attempts#8006
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse

Conversation

@Sheraff

@SheraffSheraff commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • avoid calling JSON.parse when a string's first character cannot begin valid JSON
  • apply the shortcut only when the configured parser is exactly JSON.parse
  • preserve custom parser behavior and all valid JSON prefixes, including whitespace, quotes, numbers, literals, arrays, and objects
  • add correctness cases and a focused benchmark covering expected and unfavorable distributions

Why

The default search serializer probes every string with JSON.parse so JSON-looking strings remain strings after a round trip. Ordinary application strings usually fail that probe, making exception creation and handling the dominant cost. The grammar check avoids only parses that are guaranteed to fail.

Impact

Focused local benchmarks, each serializing 1,000 objects:

  • ordinary strings: 15.694 ms to 4.571 ms (about 70.9% faster)
  • mixed application values: 4.669 ms to 0.482 ms (about 89.7% faster)
  • JSON-compatible strings remain on the parse path (0.863 ms in the latest control run)
  • strings beginning with JSON literal prefixes remain an intentionally unfavorable control (17.122 ms)

react-router.minimal changes from 85,919 to 85,956 bytes gzip (+37 bytes).

Validation

  • @tanstack/router-core:test:unit: 105 files / 1,547 tests passed, plus 3 expected failures
  • @tanstack/router-core:test:types: TypeScript 5.6 through 7.0 passed
  • @tanstack/router-core:test:eslint: zero errors (existing warnings remain)
  • focused tests/searchParams.bench.ts run
  • react-router.minimal bundle-size scenario on main and this branch
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes

    • Improved search-parameter serialization by skipping unnecessary JSON parsing for strings that cannot contain valid JSON.
    • Preserved correct handling of JSON-compatible values, empty strings, punctuation, and custom parsers.
  • Performance

    • Reduced avoidable parsing work during query-string serialization.
  • Tests

    • Expanded coverage for serialization edge cases.
    • Added benchmarks for representative search-parameter scenarios.

@coderabbitai

coderabbitaiBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ce06239-1eef-4f84-9e31-3c0ad504f4c5

📥 Commits

Reviewing files that changed from the base of the PR and between c568caf and e86a0d5.

📒 Files selected for processing (4)
  • .changeset/dirty-bushes-sink.md
  • packages/router-core/src/searchParams.ts
  • packages/router-core/tests/searchParams.bench.ts
  • packages/router-core/tests/searchParams.test.ts

📝 Walkthrough

Walkthrough

The search parameter serializer now avoids impossible JSON.parse calls by checking string prefixes. Tests and benchmarks cover default serialization, custom parsers, JSON-compatible strings, and edge cases. A patch changeset documents the router-core update.

Changes

Search serialization

Layer / File(s)Summary
Guard JSON parsing
packages/router-core/src/searchParams.ts
stringifyValue checks jsonStart and the exact JSON.parse function before parsing string values.
Validate serialization behavior
packages/router-core/tests/searchParams.test.ts, packages/router-core/tests/searchParams.bench.ts, .changeset/dirty-bushes-sink.md
Tests and benchmarks cover ordinary values, JSON-compatible strings, custom parsers, punctuation, empty strings, and mixed values. The changeset marks a patch release.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
participant stringifySearchWith
participant stringifyValue
participant JSON.parse
stringifySearchWith->>stringifyValue: serialize search value
stringifyValue->>stringifyValue: check jsonStart
stringifyValue->>JSON.parse: parse eligible string
JSON.parse-->>stringifyValue: parsed value
stringifyValue-->>stringifySearchWith: serialized value
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and concisely describes the main optimization: skipping impossible JSON parse attempts in router-core.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/search-params-skip-json-parse

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.

@nx-cloud

nx-cloudBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit e86a0d5

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded5m 19sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded23sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-08 17:21:40 UTC

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

1 package(s) bumped directly, 22 bumped as dependents.

🟩 Patch bumps

PackageVersionReason
@tanstack/router-core1.171.19 → 1.171.20Changeset
@tanstack/react-router1.170.23 → 1.170.24Dependent
@tanstack/react-start1.168.40 → 1.168.41Dependent
@tanstack/react-start-client1.168.21 → 1.168.22Dependent
@tanstack/react-start-rsc0.1.39 → 0.1.40Dependent
@tanstack/react-start-server1.167.28 → 1.167.29Dependent
@tanstack/router-cli1.167.25 → 1.167.26Dependent
@tanstack/router-generator1.167.25 → 1.167.26Dependent
@tanstack/router-plugin1.168.27 → 1.168.28Dependent
@tanstack/router-vite-plugin1.167.27 → 1.167.28Dependent
@tanstack/solid-router1.170.22 → 1.170.23Dependent
@tanstack/solid-start1.168.39 → 1.168.40Dependent
@tanstack/solid-start-client1.168.21 → 1.168.22Dependent
@tanstack/solid-start-server1.167.28 → 1.167.29Dependent
@tanstack/start-client-core1.170.19 → 1.170.20Dependent
@tanstack/start-plugin-core1.171.31 → 1.171.32Dependent
@tanstack/start-server-core1.169.23 → 1.169.24Dependent
@tanstack/start-static-server-functions1.167.24 → 1.167.25Dependent
@tanstack/start-storage-context1.167.21 → 1.167.22Dependent
@tanstack/vue-router1.170.21 → 1.170.22Dependent
@tanstack/vue-start1.168.38 → 1.168.39Dependent
@tanstack/vue-start-client1.167.24 → 1.167.25Dependent
@tanstack/vue-start-server1.167.28 → 1.167.29Dependent

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: efb9dfc55201
  • Measured at: 2026-08-08T17:17:34.467Z
  • Baseline source: history:c568caf3f376
  • Dashboard: bundle-size history

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

ScenarioCurrent (gzip)Delta vs baselineInitial gzipRawBrotliTrend
react-router.minimal83.92 KiB+17 B (+0.02%)83.78 KiB262.67 KiB72.99 KiB█████████▁▁▁
react-router.full87.43 KiB+34 B (+0.04%)87.29 KiB274.39 KiB76.15 KiB█████████▁▁▁
solid-router.minimal33.24 KiB+25 B (+0.07%)33.12 KiB96.51 KiB29.94 KiB█████████▁▁▁
solid-router.full38.07 KiB+27 B (+0.07%)37.95 KiB111.14 KiB34.25 KiB█████████▁▁▁
vue-router.minimal49.53 KiB+36 B (+0.07%)49.41 KiB138.25 KiB44.68 KiB█████████▁▁▁
vue-router.full55.11 KiB+39 B (+0.07%)54.99 KiB156.43 KiB49.59 KiB█████████▁▁▁
react-start.minimal96.70 KiB+41 B (+0.04%)96.57 KiB304.83 KiB83.82 KiB█████████▁▁▁
react-start.deferred-hydration97.44 KiB+51 B (+0.05%)96.59 KiB306.19 KiB84.42 KiB█████████▁▁▁
react-start.full99.88 KiB+50 B (+0.05%)99.75 KiB314.55 KiB86.52 KiB█████████▁▁▁
react-start.rsbuild.minimal100.02 KiB+25 B (+0.02%)99.85 KiB315.37 KiB86.20 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.minimal-iife100.42 KiB+22 B (+0.02%)100.26 KiB316.31 KiB86.58 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.full103.35 KiB+34 B (+0.03%)103.17 KiB325.46 KiB88.99 KiB▁▁▁▅▅▄▄▆▆▆▆█
solid-start.minimal45.97 KiB+31 B (+0.07%)45.85 KiB137.51 KiB40.93 KiB█████████▁▁▁
solid-start.deferred-hydration49.04 KiB+37 B (+0.07%)45.90 KiB144.97 KiB43.65 KiB█████████▁▁▁
solid-start.full51.05 KiB+37 B (+0.07%)50.93 KiB152.90 KiB45.29 KiB█████████▁▁▁
vue-start.minimal65.52 KiB+31 B (+0.05%)65.39 KiB189.02 KiB58.38 KiB█████████▁▁▁
vue-start.full69.34 KiB+55 B (+0.08%)69.21 KiB201.30 KiB61.58 KiB█████████▁▁▁

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@pkg-pr-new

pkg-pr-newBot commented Aug 8, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: e86a0d5

@codspeed-hq

codspeed-hqBot commented Aug 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 0.36%

⚠️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

⚡ 23 improved benchmarks
❌ 7 (👁 7) regressed benchmarks
✅ 150 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths redirect (solid)588.2 KB288.5 KB×2
Simulationssr request loop (react)80 ms51.8 ms+54.26%
Simulationclient-search-params navigation loop (react)59.4 ms47.1 ms+26.14%
Simulationssr rewrite localized (react)89 ms75.3 ms+18.2%
Simulationclient-search-params navigation loop (vue)80.5 ms68.4 ms+17.63%
Simulationclient-links navigation loop (react)90.6 ms77.2 ms+17.41%
Simulationclient-search-params navigation loop (solid)114.8 ms99.9 ms+14.93%
Simulationssr request loop (solid)158 ms144.4 ms+9.41%
Simulationssr rewrite passthrough (react)114.1 ms104.6 ms+9.08%
Simulationclient-links navigation loop (vue)163.9 ms150.5 ms+8.92%
Simulationssr rewrite localized (solid)126.6 ms117 ms+8.17%
Simulationclient-side navigation loop (react)41.2 ms38.1 ms+8.05%
Simulationssr request loop (vue)270.2 ms254.9 ms+6%
Memorymem client preload-churn (vue)776.2 KB735.3 KB+5.57%
Simulationclient-rewrites navigation loop (react)44.6 ms42.4 ms+5.21%
Simulationclient-rewrites navigation loop (vue)48.1 ms45.9 ms+4.77%
Simulationclient-side navigation loop (vue)70.1 ms67 ms+4.6%
Simulationclient-side navigation loop (solid)88 ms84.4 ms+4.26%
Simulationssr rewrite localized (vue)214.6 ms206.9 ms+3.74%
Memorymem server serialization-payload (solid)3.5 MB3.4 MB+3.51%
..................

ℹ️ 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 agent/search-params-skip-json-parse (e86a0d5) with main (c568caf)

Open in CodSpeed

@Sheraff
Sheraff marked this pull request as ready for review August 8, 2026 17:14
@Sheraff
Sheraff merged commit 44a8c3e into mainAug 8, 2026
26 checks passed
@Sheraff
Sheraff deleted the agent/search-params-skip-json-parse branch August 8, 2026 17:43
@github-actionsgithub-actionsBot mentioned this pull request Aug 8, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@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

perf(router-core): skip impossible JSON parse attempts - #8006

Merged
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse
Aug 8, 2026
Merged

perf(router-core): skip impossible JSON parse attempts#8006
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse

Conversation

@Sheraff

@SheraffSheraff commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • avoid calling JSON.parse when a string's first character cannot begin valid JSON
  • apply the shortcut only when the configured parser is exactly JSON.parse
  • preserve custom parser behavior and all valid JSON prefixes, including whitespace, quotes, numbers, literals, arrays, and objects
  • add correctness cases and a focused benchmark covering expected and unfavorable distributions

Why

The default search serializer probes every string with JSON.parse so JSON-looking strings remain strings after a round trip. Ordinary application strings usually fail that probe, making exception creation and handling the dominant cost. The grammar check avoids only parses that are guaranteed to fail.

Impact

Focused local benchmarks, each serializing 1,000 objects:

  • ordinary strings: 15.694 ms to 4.571 ms (about 70.9% faster)
  • mixed application values: 4.669 ms to 0.482 ms (about 89.7% faster)
  • JSON-compatible strings remain on the parse path (0.863 ms in the latest control run)
  • strings beginning with JSON literal prefixes remain an intentionally unfavorable control (17.122 ms)

react-router.minimal changes from 85,919 to 85,956 bytes gzip (+37 bytes).

Validation

  • @tanstack/router-core:test:unit: 105 files / 1,547 tests passed, plus 3 expected failures
  • @tanstack/router-core:test:types: TypeScript 5.6 through 7.0 passed
  • @tanstack/router-core:test:eslint: zero errors (existing warnings remain)
  • focused tests/searchParams.bench.ts run
  • react-router.minimal bundle-size scenario on main and this branch
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes

    • Improved search-parameter serialization by skipping unnecessary JSON parsing for strings that cannot contain valid JSON.
    • Preserved correct handling of JSON-compatible values, empty strings, punctuation, and custom parsers.
  • Performance

    • Reduced avoidable parsing work during query-string serialization.
  • Tests

    • Expanded coverage for serialization edge cases.
    • Added benchmarks for representative search-parameter scenarios.

@coderabbitai

coderabbitaiBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ce06239-1eef-4f84-9e31-3c0ad504f4c5

📥 Commits

Reviewing files that changed from the base of the PR and between c568caf and e86a0d5.

📒 Files selected for processing (4)
  • .changeset/dirty-bushes-sink.md
  • packages/router-core/src/searchParams.ts
  • packages/router-core/tests/searchParams.bench.ts
  • packages/router-core/tests/searchParams.test.ts

📝 Walkthrough

Walkthrough

The search parameter serializer now avoids impossible JSON.parse calls by checking string prefixes. Tests and benchmarks cover default serialization, custom parsers, JSON-compatible strings, and edge cases. A patch changeset documents the router-core update.

Changes

Search serialization

Layer / File(s)Summary
Guard JSON parsing
packages/router-core/src/searchParams.ts
stringifyValue checks jsonStart and the exact JSON.parse function before parsing string values.
Validate serialization behavior
packages/router-core/tests/searchParams.test.ts, packages/router-core/tests/searchParams.bench.ts, .changeset/dirty-bushes-sink.md
Tests and benchmarks cover ordinary values, JSON-compatible strings, custom parsers, punctuation, empty strings, and mixed values. The changeset marks a patch release.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
participant stringifySearchWith
participant stringifyValue
participant JSON.parse
stringifySearchWith->>stringifyValue: serialize search value
stringifyValue->>stringifyValue: check jsonStart
stringifyValue->>JSON.parse: parse eligible string
JSON.parse-->>stringifyValue: parsed value
stringifyValue-->>stringifySearchWith: serialized value
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and concisely describes the main optimization: skipping impossible JSON parse attempts in router-core.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/search-params-skip-json-parse

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.

@nx-cloud

nx-cloudBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit e86a0d5

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded5m 19sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded23sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-08 17:21:40 UTC

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

1 package(s) bumped directly, 22 bumped as dependents.

🟩 Patch bumps

PackageVersionReason
@tanstack/router-core1.171.19 → 1.171.20Changeset
@tanstack/react-router1.170.23 → 1.170.24Dependent
@tanstack/react-start1.168.40 → 1.168.41Dependent
@tanstack/react-start-client1.168.21 → 1.168.22Dependent
@tanstack/react-start-rsc0.1.39 → 0.1.40Dependent
@tanstack/react-start-server1.167.28 → 1.167.29Dependent
@tanstack/router-cli1.167.25 → 1.167.26Dependent
@tanstack/router-generator1.167.25 → 1.167.26Dependent
@tanstack/router-plugin1.168.27 → 1.168.28Dependent
@tanstack/router-vite-plugin1.167.27 → 1.167.28Dependent
@tanstack/solid-router1.170.22 → 1.170.23Dependent
@tanstack/solid-start1.168.39 → 1.168.40Dependent
@tanstack/solid-start-client1.168.21 → 1.168.22Dependent
@tanstack/solid-start-server1.167.28 → 1.167.29Dependent
@tanstack/start-client-core1.170.19 → 1.170.20Dependent
@tanstack/start-plugin-core1.171.31 → 1.171.32Dependent
@tanstack/start-server-core1.169.23 → 1.169.24Dependent
@tanstack/start-static-server-functions1.167.24 → 1.167.25Dependent
@tanstack/start-storage-context1.167.21 → 1.167.22Dependent
@tanstack/vue-router1.170.21 → 1.170.22Dependent
@tanstack/vue-start1.168.38 → 1.168.39Dependent
@tanstack/vue-start-client1.167.24 → 1.167.25Dependent
@tanstack/vue-start-server1.167.28 → 1.167.29Dependent

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: efb9dfc55201
  • Measured at: 2026-08-08T17:17:34.467Z
  • Baseline source: history:c568caf3f376
  • Dashboard: bundle-size history

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

ScenarioCurrent (gzip)Delta vs baselineInitial gzipRawBrotliTrend
react-router.minimal83.92 KiB+17 B (+0.02%)83.78 KiB262.67 KiB72.99 KiB█████████▁▁▁
react-router.full87.43 KiB+34 B (+0.04%)87.29 KiB274.39 KiB76.15 KiB█████████▁▁▁
solid-router.minimal33.24 KiB+25 B (+0.07%)33.12 KiB96.51 KiB29.94 KiB█████████▁▁▁
solid-router.full38.07 KiB+27 B (+0.07%)37.95 KiB111.14 KiB34.25 KiB█████████▁▁▁
vue-router.minimal49.53 KiB+36 B (+0.07%)49.41 KiB138.25 KiB44.68 KiB█████████▁▁▁
vue-router.full55.11 KiB+39 B (+0.07%)54.99 KiB156.43 KiB49.59 KiB█████████▁▁▁
react-start.minimal96.70 KiB+41 B (+0.04%)96.57 KiB304.83 KiB83.82 KiB█████████▁▁▁
react-start.deferred-hydration97.44 KiB+51 B (+0.05%)96.59 KiB306.19 KiB84.42 KiB█████████▁▁▁
react-start.full99.88 KiB+50 B (+0.05%)99.75 KiB314.55 KiB86.52 KiB█████████▁▁▁
react-start.rsbuild.minimal100.02 KiB+25 B (+0.02%)99.85 KiB315.37 KiB86.20 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.minimal-iife100.42 KiB+22 B (+0.02%)100.26 KiB316.31 KiB86.58 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.full103.35 KiB+34 B (+0.03%)103.17 KiB325.46 KiB88.99 KiB▁▁▁▅▅▄▄▆▆▆▆█
solid-start.minimal45.97 KiB+31 B (+0.07%)45.85 KiB137.51 KiB40.93 KiB█████████▁▁▁
solid-start.deferred-hydration49.04 KiB+37 B (+0.07%)45.90 KiB144.97 KiB43.65 KiB█████████▁▁▁
solid-start.full51.05 KiB+37 B (+0.07%)50.93 KiB152.90 KiB45.29 KiB█████████▁▁▁
vue-start.minimal65.52 KiB+31 B (+0.05%)65.39 KiB189.02 KiB58.38 KiB█████████▁▁▁
vue-start.full69.34 KiB+55 B (+0.08%)69.21 KiB201.30 KiB61.58 KiB█████████▁▁▁

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@pkg-pr-new

pkg-pr-newBot commented Aug 8, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: e86a0d5

@codspeed-hq

codspeed-hqBot commented Aug 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 0.36%

⚠️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

⚡ 23 improved benchmarks
❌ 7 (👁 7) regressed benchmarks
✅ 150 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths redirect (solid)588.2 KB288.5 KB×2
Simulationssr request loop (react)80 ms51.8 ms+54.26%
Simulationclient-search-params navigation loop (react)59.4 ms47.1 ms+26.14%
Simulationssr rewrite localized (react)89 ms75.3 ms+18.2%
Simulationclient-search-params navigation loop (vue)80.5 ms68.4 ms+17.63%
Simulationclient-links navigation loop (react)90.6 ms77.2 ms+17.41%
Simulationclient-search-params navigation loop (solid)114.8 ms99.9 ms+14.93%
Simulationssr request loop (solid)158 ms144.4 ms+9.41%
Simulationssr rewrite passthrough (react)114.1 ms104.6 ms+9.08%
Simulationclient-links navigation loop (vue)163.9 ms150.5 ms+8.92%
Simulationssr rewrite localized (solid)126.6 ms117 ms+8.17%
Simulationclient-side navigation loop (react)41.2 ms38.1 ms+8.05%
Simulationssr request loop (vue)270.2 ms254.9 ms+6%
Memorymem client preload-churn (vue)776.2 KB735.3 KB+5.57%
Simulationclient-rewrites navigation loop (react)44.6 ms42.4 ms+5.21%
Simulationclient-rewrites navigation loop (vue)48.1 ms45.9 ms+4.77%
Simulationclient-side navigation loop (vue)70.1 ms67 ms+4.6%
Simulationclient-side navigation loop (solid)88 ms84.4 ms+4.26%
Simulationssr rewrite localized (vue)214.6 ms206.9 ms+3.74%
Memorymem server serialization-payload (solid)3.5 MB3.4 MB+3.51%
..................

ℹ️ 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 agent/search-params-skip-json-parse (e86a0d5) with main (c568caf)

Open in CodSpeed

@Sheraff
Sheraff marked this pull request as ready for review August 8, 2026 17:14
@Sheraff
Sheraff merged commit 44a8c3e into mainAug 8, 2026
26 checks passed
@Sheraff
Sheraff deleted the agent/search-params-skip-json-parse branch August 8, 2026 17:43
@github-actionsgithub-actionsBot mentioned this pull request Aug 8, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@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

perf(router-core): skip impossible JSON parse attempts - #8006

Merged
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse
Aug 8, 2026
Merged

perf(router-core): skip impossible JSON parse attempts#8006
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse

Conversation

@Sheraff

@SheraffSheraff commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • avoid calling JSON.parse when a string's first character cannot begin valid JSON
  • apply the shortcut only when the configured parser is exactly JSON.parse
  • preserve custom parser behavior and all valid JSON prefixes, including whitespace, quotes, numbers, literals, arrays, and objects
  • add correctness cases and a focused benchmark covering expected and unfavorable distributions

Why

The default search serializer probes every string with JSON.parse so JSON-looking strings remain strings after a round trip. Ordinary application strings usually fail that probe, making exception creation and handling the dominant cost. The grammar check avoids only parses that are guaranteed to fail.

Impact

Focused local benchmarks, each serializing 1,000 objects:

  • ordinary strings: 15.694 ms to 4.571 ms (about 70.9% faster)
  • mixed application values: 4.669 ms to 0.482 ms (about 89.7% faster)
  • JSON-compatible strings remain on the parse path (0.863 ms in the latest control run)
  • strings beginning with JSON literal prefixes remain an intentionally unfavorable control (17.122 ms)

react-router.minimal changes from 85,919 to 85,956 bytes gzip (+37 bytes).

Validation

  • @tanstack/router-core:test:unit: 105 files / 1,547 tests passed, plus 3 expected failures
  • @tanstack/router-core:test:types: TypeScript 5.6 through 7.0 passed
  • @tanstack/router-core:test:eslint: zero errors (existing warnings remain)
  • focused tests/searchParams.bench.ts run
  • react-router.minimal bundle-size scenario on main and this branch
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes

    • Improved search-parameter serialization by skipping unnecessary JSON parsing for strings that cannot contain valid JSON.
    • Preserved correct handling of JSON-compatible values, empty strings, punctuation, and custom parsers.
  • Performance

    • Reduced avoidable parsing work during query-string serialization.
  • Tests

    • Expanded coverage for serialization edge cases.
    • Added benchmarks for representative search-parameter scenarios.

@coderabbitai

coderabbitaiBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ce06239-1eef-4f84-9e31-3c0ad504f4c5

📥 Commits

Reviewing files that changed from the base of the PR and between c568caf and e86a0d5.

📒 Files selected for processing (4)
  • .changeset/dirty-bushes-sink.md
  • packages/router-core/src/searchParams.ts
  • packages/router-core/tests/searchParams.bench.ts
  • packages/router-core/tests/searchParams.test.ts

📝 Walkthrough

Walkthrough

The search parameter serializer now avoids impossible JSON.parse calls by checking string prefixes. Tests and benchmarks cover default serialization, custom parsers, JSON-compatible strings, and edge cases. A patch changeset documents the router-core update.

Changes

Search serialization

Layer / File(s)Summary
Guard JSON parsing
packages/router-core/src/searchParams.ts
stringifyValue checks jsonStart and the exact JSON.parse function before parsing string values.
Validate serialization behavior
packages/router-core/tests/searchParams.test.ts, packages/router-core/tests/searchParams.bench.ts, .changeset/dirty-bushes-sink.md
Tests and benchmarks cover ordinary values, JSON-compatible strings, custom parsers, punctuation, empty strings, and mixed values. The changeset marks a patch release.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
participant stringifySearchWith
participant stringifyValue
participant JSON.parse
stringifySearchWith->>stringifyValue: serialize search value
stringifyValue->>stringifyValue: check jsonStart
stringifyValue->>JSON.parse: parse eligible string
JSON.parse-->>stringifyValue: parsed value
stringifyValue-->>stringifySearchWith: serialized value
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and concisely describes the main optimization: skipping impossible JSON parse attempts in router-core.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/search-params-skip-json-parse

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.

@nx-cloud

nx-cloudBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit e86a0d5

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded5m 19sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded23sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-08 17:21:40 UTC

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

1 package(s) bumped directly, 22 bumped as dependents.

🟩 Patch bumps

PackageVersionReason
@tanstack/router-core1.171.19 → 1.171.20Changeset
@tanstack/react-router1.170.23 → 1.170.24Dependent
@tanstack/react-start1.168.40 → 1.168.41Dependent
@tanstack/react-start-client1.168.21 → 1.168.22Dependent
@tanstack/react-start-rsc0.1.39 → 0.1.40Dependent
@tanstack/react-start-server1.167.28 → 1.167.29Dependent
@tanstack/router-cli1.167.25 → 1.167.26Dependent
@tanstack/router-generator1.167.25 → 1.167.26Dependent
@tanstack/router-plugin1.168.27 → 1.168.28Dependent
@tanstack/router-vite-plugin1.167.27 → 1.167.28Dependent
@tanstack/solid-router1.170.22 → 1.170.23Dependent
@tanstack/solid-start1.168.39 → 1.168.40Dependent
@tanstack/solid-start-client1.168.21 → 1.168.22Dependent
@tanstack/solid-start-server1.167.28 → 1.167.29Dependent
@tanstack/start-client-core1.170.19 → 1.170.20Dependent
@tanstack/start-plugin-core1.171.31 → 1.171.32Dependent
@tanstack/start-server-core1.169.23 → 1.169.24Dependent
@tanstack/start-static-server-functions1.167.24 → 1.167.25Dependent
@tanstack/start-storage-context1.167.21 → 1.167.22Dependent
@tanstack/vue-router1.170.21 → 1.170.22Dependent
@tanstack/vue-start1.168.38 → 1.168.39Dependent
@tanstack/vue-start-client1.167.24 → 1.167.25Dependent
@tanstack/vue-start-server1.167.28 → 1.167.29Dependent

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: efb9dfc55201
  • Measured at: 2026-08-08T17:17:34.467Z
  • Baseline source: history:c568caf3f376
  • Dashboard: bundle-size history

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

ScenarioCurrent (gzip)Delta vs baselineInitial gzipRawBrotliTrend
react-router.minimal83.92 KiB+17 B (+0.02%)83.78 KiB262.67 KiB72.99 KiB█████████▁▁▁
react-router.full87.43 KiB+34 B (+0.04%)87.29 KiB274.39 KiB76.15 KiB█████████▁▁▁
solid-router.minimal33.24 KiB+25 B (+0.07%)33.12 KiB96.51 KiB29.94 KiB█████████▁▁▁
solid-router.full38.07 KiB+27 B (+0.07%)37.95 KiB111.14 KiB34.25 KiB█████████▁▁▁
vue-router.minimal49.53 KiB+36 B (+0.07%)49.41 KiB138.25 KiB44.68 KiB█████████▁▁▁
vue-router.full55.11 KiB+39 B (+0.07%)54.99 KiB156.43 KiB49.59 KiB█████████▁▁▁
react-start.minimal96.70 KiB+41 B (+0.04%)96.57 KiB304.83 KiB83.82 KiB█████████▁▁▁
react-start.deferred-hydration97.44 KiB+51 B (+0.05%)96.59 KiB306.19 KiB84.42 KiB█████████▁▁▁
react-start.full99.88 KiB+50 B (+0.05%)99.75 KiB314.55 KiB86.52 KiB█████████▁▁▁
react-start.rsbuild.minimal100.02 KiB+25 B (+0.02%)99.85 KiB315.37 KiB86.20 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.minimal-iife100.42 KiB+22 B (+0.02%)100.26 KiB316.31 KiB86.58 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.full103.35 KiB+34 B (+0.03%)103.17 KiB325.46 KiB88.99 KiB▁▁▁▅▅▄▄▆▆▆▆█
solid-start.minimal45.97 KiB+31 B (+0.07%)45.85 KiB137.51 KiB40.93 KiB█████████▁▁▁
solid-start.deferred-hydration49.04 KiB+37 B (+0.07%)45.90 KiB144.97 KiB43.65 KiB█████████▁▁▁
solid-start.full51.05 KiB+37 B (+0.07%)50.93 KiB152.90 KiB45.29 KiB█████████▁▁▁
vue-start.minimal65.52 KiB+31 B (+0.05%)65.39 KiB189.02 KiB58.38 KiB█████████▁▁▁
vue-start.full69.34 KiB+55 B (+0.08%)69.21 KiB201.30 KiB61.58 KiB█████████▁▁▁

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@pkg-pr-new

pkg-pr-newBot commented Aug 8, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: e86a0d5

@codspeed-hq

codspeed-hqBot commented Aug 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 0.36%

⚠️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

⚡ 23 improved benchmarks
❌ 7 (👁 7) regressed benchmarks
✅ 150 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths redirect (solid)588.2 KB288.5 KB×2
Simulationssr request loop (react)80 ms51.8 ms+54.26%
Simulationclient-search-params navigation loop (react)59.4 ms47.1 ms+26.14%
Simulationssr rewrite localized (react)89 ms75.3 ms+18.2%
Simulationclient-search-params navigation loop (vue)80.5 ms68.4 ms+17.63%
Simulationclient-links navigation loop (react)90.6 ms77.2 ms+17.41%
Simulationclient-search-params navigation loop (solid)114.8 ms99.9 ms+14.93%
Simulationssr request loop (solid)158 ms144.4 ms+9.41%
Simulationssr rewrite passthrough (react)114.1 ms104.6 ms+9.08%
Simulationclient-links navigation loop (vue)163.9 ms150.5 ms+8.92%
Simulationssr rewrite localized (solid)126.6 ms117 ms+8.17%
Simulationclient-side navigation loop (react)41.2 ms38.1 ms+8.05%
Simulationssr request loop (vue)270.2 ms254.9 ms+6%
Memorymem client preload-churn (vue)776.2 KB735.3 KB+5.57%
Simulationclient-rewrites navigation loop (react)44.6 ms42.4 ms+5.21%
Simulationclient-rewrites navigation loop (vue)48.1 ms45.9 ms+4.77%
Simulationclient-side navigation loop (vue)70.1 ms67 ms+4.6%
Simulationclient-side navigation loop (solid)88 ms84.4 ms+4.26%
Simulationssr rewrite localized (vue)214.6 ms206.9 ms+3.74%
Memorymem server serialization-payload (solid)3.5 MB3.4 MB+3.51%
..................

ℹ️ 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 agent/search-params-skip-json-parse (e86a0d5) with main (c568caf)

Open in CodSpeed

@Sheraff
Sheraff marked this pull request as ready for review August 8, 2026 17:14
@Sheraff
Sheraff merged commit 44a8c3e into mainAug 8, 2026
26 checks passed
@Sheraff
Sheraff deleted the agent/search-params-skip-json-parse branch August 8, 2026 17:43
@github-actionsgithub-actionsBot mentioned this pull request Aug 8, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@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

perf(router-core): skip impossible JSON parse attempts - #8006

Merged
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse
Aug 8, 2026
Merged

perf(router-core): skip impossible JSON parse attempts#8006
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse

Conversation

@Sheraff

@SheraffSheraff commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • avoid calling JSON.parse when a string's first character cannot begin valid JSON
  • apply the shortcut only when the configured parser is exactly JSON.parse
  • preserve custom parser behavior and all valid JSON prefixes, including whitespace, quotes, numbers, literals, arrays, and objects
  • add correctness cases and a focused benchmark covering expected and unfavorable distributions

Why

The default search serializer probes every string with JSON.parse so JSON-looking strings remain strings after a round trip. Ordinary application strings usually fail that probe, making exception creation and handling the dominant cost. The grammar check avoids only parses that are guaranteed to fail.

Impact

Focused local benchmarks, each serializing 1,000 objects:

  • ordinary strings: 15.694 ms to 4.571 ms (about 70.9% faster)
  • mixed application values: 4.669 ms to 0.482 ms (about 89.7% faster)
  • JSON-compatible strings remain on the parse path (0.863 ms in the latest control run)
  • strings beginning with JSON literal prefixes remain an intentionally unfavorable control (17.122 ms)

react-router.minimal changes from 85,919 to 85,956 bytes gzip (+37 bytes).

Validation

  • @tanstack/router-core:test:unit: 105 files / 1,547 tests passed, plus 3 expected failures
  • @tanstack/router-core:test:types: TypeScript 5.6 through 7.0 passed
  • @tanstack/router-core:test:eslint: zero errors (existing warnings remain)
  • focused tests/searchParams.bench.ts run
  • react-router.minimal bundle-size scenario on main and this branch
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes

    • Improved search-parameter serialization by skipping unnecessary JSON parsing for strings that cannot contain valid JSON.
    • Preserved correct handling of JSON-compatible values, empty strings, punctuation, and custom parsers.
  • Performance

    • Reduced avoidable parsing work during query-string serialization.
  • Tests

    • Expanded coverage for serialization edge cases.
    • Added benchmarks for representative search-parameter scenarios.

@coderabbitai

coderabbitaiBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ce06239-1eef-4f84-9e31-3c0ad504f4c5

📥 Commits

Reviewing files that changed from the base of the PR and between c568caf and e86a0d5.

📒 Files selected for processing (4)
  • .changeset/dirty-bushes-sink.md
  • packages/router-core/src/searchParams.ts
  • packages/router-core/tests/searchParams.bench.ts
  • packages/router-core/tests/searchParams.test.ts

📝 Walkthrough

Walkthrough

The search parameter serializer now avoids impossible JSON.parse calls by checking string prefixes. Tests and benchmarks cover default serialization, custom parsers, JSON-compatible strings, and edge cases. A patch changeset documents the router-core update.

Changes

Search serialization

Layer / File(s)Summary
Guard JSON parsing
packages/router-core/src/searchParams.ts
stringifyValue checks jsonStart and the exact JSON.parse function before parsing string values.
Validate serialization behavior
packages/router-core/tests/searchParams.test.ts, packages/router-core/tests/searchParams.bench.ts, .changeset/dirty-bushes-sink.md
Tests and benchmarks cover ordinary values, JSON-compatible strings, custom parsers, punctuation, empty strings, and mixed values. The changeset marks a patch release.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
participant stringifySearchWith
participant stringifyValue
participant JSON.parse
stringifySearchWith->>stringifyValue: serialize search value
stringifyValue->>stringifyValue: check jsonStart
stringifyValue->>JSON.parse: parse eligible string
JSON.parse-->>stringifyValue: parsed value
stringifyValue-->>stringifySearchWith: serialized value
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and concisely describes the main optimization: skipping impossible JSON parse attempts in router-core.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/search-params-skip-json-parse

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.

@nx-cloud

nx-cloudBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit e86a0d5

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded5m 19sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded23sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-08 17:21:40 UTC

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

1 package(s) bumped directly, 22 bumped as dependents.

🟩 Patch bumps

PackageVersionReason
@tanstack/router-core1.171.19 → 1.171.20Changeset
@tanstack/react-router1.170.23 → 1.170.24Dependent
@tanstack/react-start1.168.40 → 1.168.41Dependent
@tanstack/react-start-client1.168.21 → 1.168.22Dependent
@tanstack/react-start-rsc0.1.39 → 0.1.40Dependent
@tanstack/react-start-server1.167.28 → 1.167.29Dependent
@tanstack/router-cli1.167.25 → 1.167.26Dependent
@tanstack/router-generator1.167.25 → 1.167.26Dependent
@tanstack/router-plugin1.168.27 → 1.168.28Dependent
@tanstack/router-vite-plugin1.167.27 → 1.167.28Dependent
@tanstack/solid-router1.170.22 → 1.170.23Dependent
@tanstack/solid-start1.168.39 → 1.168.40Dependent
@tanstack/solid-start-client1.168.21 → 1.168.22Dependent
@tanstack/solid-start-server1.167.28 → 1.167.29Dependent
@tanstack/start-client-core1.170.19 → 1.170.20Dependent
@tanstack/start-plugin-core1.171.31 → 1.171.32Dependent
@tanstack/start-server-core1.169.23 → 1.169.24Dependent
@tanstack/start-static-server-functions1.167.24 → 1.167.25Dependent
@tanstack/start-storage-context1.167.21 → 1.167.22Dependent
@tanstack/vue-router1.170.21 → 1.170.22Dependent
@tanstack/vue-start1.168.38 → 1.168.39Dependent
@tanstack/vue-start-client1.167.24 → 1.167.25Dependent
@tanstack/vue-start-server1.167.28 → 1.167.29Dependent

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: efb9dfc55201
  • Measured at: 2026-08-08T17:17:34.467Z
  • Baseline source: history:c568caf3f376
  • Dashboard: bundle-size history

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

ScenarioCurrent (gzip)Delta vs baselineInitial gzipRawBrotliTrend
react-router.minimal83.92 KiB+17 B (+0.02%)83.78 KiB262.67 KiB72.99 KiB█████████▁▁▁
react-router.full87.43 KiB+34 B (+0.04%)87.29 KiB274.39 KiB76.15 KiB█████████▁▁▁
solid-router.minimal33.24 KiB+25 B (+0.07%)33.12 KiB96.51 KiB29.94 KiB█████████▁▁▁
solid-router.full38.07 KiB+27 B (+0.07%)37.95 KiB111.14 KiB34.25 KiB█████████▁▁▁
vue-router.minimal49.53 KiB+36 B (+0.07%)49.41 KiB138.25 KiB44.68 KiB█████████▁▁▁
vue-router.full55.11 KiB+39 B (+0.07%)54.99 KiB156.43 KiB49.59 KiB█████████▁▁▁
react-start.minimal96.70 KiB+41 B (+0.04%)96.57 KiB304.83 KiB83.82 KiB█████████▁▁▁
react-start.deferred-hydration97.44 KiB+51 B (+0.05%)96.59 KiB306.19 KiB84.42 KiB█████████▁▁▁
react-start.full99.88 KiB+50 B (+0.05%)99.75 KiB314.55 KiB86.52 KiB█████████▁▁▁
react-start.rsbuild.minimal100.02 KiB+25 B (+0.02%)99.85 KiB315.37 KiB86.20 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.minimal-iife100.42 KiB+22 B (+0.02%)100.26 KiB316.31 KiB86.58 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.full103.35 KiB+34 B (+0.03%)103.17 KiB325.46 KiB88.99 KiB▁▁▁▅▅▄▄▆▆▆▆█
solid-start.minimal45.97 KiB+31 B (+0.07%)45.85 KiB137.51 KiB40.93 KiB█████████▁▁▁
solid-start.deferred-hydration49.04 KiB+37 B (+0.07%)45.90 KiB144.97 KiB43.65 KiB█████████▁▁▁
solid-start.full51.05 KiB+37 B (+0.07%)50.93 KiB152.90 KiB45.29 KiB█████████▁▁▁
vue-start.minimal65.52 KiB+31 B (+0.05%)65.39 KiB189.02 KiB58.38 KiB█████████▁▁▁
vue-start.full69.34 KiB+55 B (+0.08%)69.21 KiB201.30 KiB61.58 KiB█████████▁▁▁

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@pkg-pr-new

pkg-pr-newBot commented Aug 8, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: e86a0d5

@codspeed-hq

codspeed-hqBot commented Aug 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 0.36%

⚠️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

⚡ 23 improved benchmarks
❌ 7 (👁 7) regressed benchmarks
✅ 150 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths redirect (solid)588.2 KB288.5 KB×2
Simulationssr request loop (react)80 ms51.8 ms+54.26%
Simulationclient-search-params navigation loop (react)59.4 ms47.1 ms+26.14%
Simulationssr rewrite localized (react)89 ms75.3 ms+18.2%
Simulationclient-search-params navigation loop (vue)80.5 ms68.4 ms+17.63%
Simulationclient-links navigation loop (react)90.6 ms77.2 ms+17.41%
Simulationclient-search-params navigation loop (solid)114.8 ms99.9 ms+14.93%
Simulationssr request loop (solid)158 ms144.4 ms+9.41%
Simulationssr rewrite passthrough (react)114.1 ms104.6 ms+9.08%
Simulationclient-links navigation loop (vue)163.9 ms150.5 ms+8.92%
Simulationssr rewrite localized (solid)126.6 ms117 ms+8.17%
Simulationclient-side navigation loop (react)41.2 ms38.1 ms+8.05%
Simulationssr request loop (vue)270.2 ms254.9 ms+6%
Memorymem client preload-churn (vue)776.2 KB735.3 KB+5.57%
Simulationclient-rewrites navigation loop (react)44.6 ms42.4 ms+5.21%
Simulationclient-rewrites navigation loop (vue)48.1 ms45.9 ms+4.77%
Simulationclient-side navigation loop (vue)70.1 ms67 ms+4.6%
Simulationclient-side navigation loop (solid)88 ms84.4 ms+4.26%
Simulationssr rewrite localized (vue)214.6 ms206.9 ms+3.74%
Memorymem server serialization-payload (solid)3.5 MB3.4 MB+3.51%
..................

ℹ️ 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 agent/search-params-skip-json-parse (e86a0d5) with main (c568caf)

Open in CodSpeed

@Sheraff
Sheraff marked this pull request as ready for review August 8, 2026 17:14
@Sheraff
Sheraff merged commit 44a8c3e into mainAug 8, 2026
26 checks passed
@Sheraff
Sheraff deleted the agent/search-params-skip-json-parse branch August 8, 2026 17:43
@github-actionsgithub-actionsBot mentioned this pull request Aug 8, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@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

perf(router-core): skip impossible JSON parse attempts - #8006

Merged
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse
Aug 8, 2026
Merged

perf(router-core): skip impossible JSON parse attempts#8006
Sheraff merged 3 commits into
mainfrom
agent/search-params-skip-json-parse

Conversation

@Sheraff

@SheraffSheraff commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • avoid calling JSON.parse when a string's first character cannot begin valid JSON
  • apply the shortcut only when the configured parser is exactly JSON.parse
  • preserve custom parser behavior and all valid JSON prefixes, including whitespace, quotes, numbers, literals, arrays, and objects
  • add correctness cases and a focused benchmark covering expected and unfavorable distributions

Why

The default search serializer probes every string with JSON.parse so JSON-looking strings remain strings after a round trip. Ordinary application strings usually fail that probe, making exception creation and handling the dominant cost. The grammar check avoids only parses that are guaranteed to fail.

Impact

Focused local benchmarks, each serializing 1,000 objects:

  • ordinary strings: 15.694 ms to 4.571 ms (about 70.9% faster)
  • mixed application values: 4.669 ms to 0.482 ms (about 89.7% faster)
  • JSON-compatible strings remain on the parse path (0.863 ms in the latest control run)
  • strings beginning with JSON literal prefixes remain an intentionally unfavorable control (17.122 ms)

react-router.minimal changes from 85,919 to 85,956 bytes gzip (+37 bytes).

Validation

  • @tanstack/router-core:test:unit: 105 files / 1,547 tests passed, plus 3 expected failures
  • @tanstack/router-core:test:types: TypeScript 5.6 through 7.0 passed
  • @tanstack/router-core:test:eslint: zero errors (existing warnings remain)
  • focused tests/searchParams.bench.ts run
  • react-router.minimal bundle-size scenario on main and this branch
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes

    • Improved search-parameter serialization by skipping unnecessary JSON parsing for strings that cannot contain valid JSON.
    • Preserved correct handling of JSON-compatible values, empty strings, punctuation, and custom parsers.
  • Performance

    • Reduced avoidable parsing work during query-string serialization.
  • Tests

    • Expanded coverage for serialization edge cases.
    • Added benchmarks for representative search-parameter scenarios.

@coderabbitai

coderabbitaiBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ce06239-1eef-4f84-9e31-3c0ad504f4c5

📥 Commits

Reviewing files that changed from the base of the PR and between c568caf and e86a0d5.

📒 Files selected for processing (4)
  • .changeset/dirty-bushes-sink.md
  • packages/router-core/src/searchParams.ts
  • packages/router-core/tests/searchParams.bench.ts
  • packages/router-core/tests/searchParams.test.ts

📝 Walkthrough

Walkthrough

The search parameter serializer now avoids impossible JSON.parse calls by checking string prefixes. Tests and benchmarks cover default serialization, custom parsers, JSON-compatible strings, and edge cases. A patch changeset documents the router-core update.

Changes

Search serialization

Layer / File(s)Summary
Guard JSON parsing
packages/router-core/src/searchParams.ts
stringifyValue checks jsonStart and the exact JSON.parse function before parsing string values.
Validate serialization behavior
packages/router-core/tests/searchParams.test.ts, packages/router-core/tests/searchParams.bench.ts, .changeset/dirty-bushes-sink.md
Tests and benchmarks cover ordinary values, JSON-compatible strings, custom parsers, punctuation, empty strings, and mixed values. The changeset marks a patch release.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
participant stringifySearchWith
participant stringifyValue
participant JSON.parse
stringifySearchWith->>stringifyValue: serialize search value
stringifyValue->>stringifyValue: check jsonStart
stringifyValue->>JSON.parse: parse eligible string
JSON.parse-->>stringifyValue: parsed value
stringifyValue-->>stringifySearchWith: serialized value
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and concisely describes the main optimization: skipping impossible JSON parse attempts in router-core.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/search-params-skip-json-parse

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.

@nx-cloud

nx-cloudBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit e86a0d5

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded5m 19sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded23sView ↗

☁️ Nx Cloud last updated this comment at 2026-08-08 17:21:40 UTC

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

1 package(s) bumped directly, 22 bumped as dependents.

🟩 Patch bumps

PackageVersionReason
@tanstack/router-core1.171.19 → 1.171.20Changeset
@tanstack/react-router1.170.23 → 1.170.24Dependent
@tanstack/react-start1.168.40 → 1.168.41Dependent
@tanstack/react-start-client1.168.21 → 1.168.22Dependent
@tanstack/react-start-rsc0.1.39 → 0.1.40Dependent
@tanstack/react-start-server1.167.28 → 1.167.29Dependent
@tanstack/router-cli1.167.25 → 1.167.26Dependent
@tanstack/router-generator1.167.25 → 1.167.26Dependent
@tanstack/router-plugin1.168.27 → 1.168.28Dependent
@tanstack/router-vite-plugin1.167.27 → 1.167.28Dependent
@tanstack/solid-router1.170.22 → 1.170.23Dependent
@tanstack/solid-start1.168.39 → 1.168.40Dependent
@tanstack/solid-start-client1.168.21 → 1.168.22Dependent
@tanstack/solid-start-server1.167.28 → 1.167.29Dependent
@tanstack/start-client-core1.170.19 → 1.170.20Dependent
@tanstack/start-plugin-core1.171.31 → 1.171.32Dependent
@tanstack/start-server-core1.169.23 → 1.169.24Dependent
@tanstack/start-static-server-functions1.167.24 → 1.167.25Dependent
@tanstack/start-storage-context1.167.21 → 1.167.22Dependent
@tanstack/vue-router1.170.21 → 1.170.22Dependent
@tanstack/vue-start1.168.38 → 1.168.39Dependent
@tanstack/vue-start-client1.167.24 → 1.167.25Dependent
@tanstack/vue-start-server1.167.28 → 1.167.29Dependent

@github-actions

github-actionsBot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: efb9dfc55201
  • Measured at: 2026-08-08T17:17:34.467Z
  • Baseline source: history:c568caf3f376
  • Dashboard: bundle-size history

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

ScenarioCurrent (gzip)Delta vs baselineInitial gzipRawBrotliTrend
react-router.minimal83.92 KiB+17 B (+0.02%)83.78 KiB262.67 KiB72.99 KiB█████████▁▁▁
react-router.full87.43 KiB+34 B (+0.04%)87.29 KiB274.39 KiB76.15 KiB█████████▁▁▁
solid-router.minimal33.24 KiB+25 B (+0.07%)33.12 KiB96.51 KiB29.94 KiB█████████▁▁▁
solid-router.full38.07 KiB+27 B (+0.07%)37.95 KiB111.14 KiB34.25 KiB█████████▁▁▁
vue-router.minimal49.53 KiB+36 B (+0.07%)49.41 KiB138.25 KiB44.68 KiB█████████▁▁▁
vue-router.full55.11 KiB+39 B (+0.07%)54.99 KiB156.43 KiB49.59 KiB█████████▁▁▁
react-start.minimal96.70 KiB+41 B (+0.04%)96.57 KiB304.83 KiB83.82 KiB█████████▁▁▁
react-start.deferred-hydration97.44 KiB+51 B (+0.05%)96.59 KiB306.19 KiB84.42 KiB█████████▁▁▁
react-start.full99.88 KiB+50 B (+0.05%)99.75 KiB314.55 KiB86.52 KiB█████████▁▁▁
react-start.rsbuild.minimal100.02 KiB+25 B (+0.02%)99.85 KiB315.37 KiB86.20 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.minimal-iife100.42 KiB+22 B (+0.02%)100.26 KiB316.31 KiB86.58 KiB▁▁▁▆▆▅▅▆▆▆▆█
react-start.rsbuild.full103.35 KiB+34 B (+0.03%)103.17 KiB325.46 KiB88.99 KiB▁▁▁▅▅▄▄▆▆▆▆█
solid-start.minimal45.97 KiB+31 B (+0.07%)45.85 KiB137.51 KiB40.93 KiB█████████▁▁▁
solid-start.deferred-hydration49.04 KiB+37 B (+0.07%)45.90 KiB144.97 KiB43.65 KiB█████████▁▁▁
solid-start.full51.05 KiB+37 B (+0.07%)50.93 KiB152.90 KiB45.29 KiB█████████▁▁▁
vue-start.minimal65.52 KiB+31 B (+0.05%)65.39 KiB189.02 KiB58.38 KiB█████████▁▁▁
vue-start.full69.34 KiB+55 B (+0.08%)69.21 KiB201.30 KiB61.58 KiB█████████▁▁▁

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@pkg-pr-new

pkg-pr-newBot commented Aug 8, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: e86a0d5

@codspeed-hq

codspeed-hqBot commented Aug 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 0.36%

⚠️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

⚡ 23 improved benchmarks
❌ 7 (👁 7) regressed benchmarks
✅ 150 untouched benchmarks

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths redirect (solid)588.2 KB288.5 KB×2
Simulationssr request loop (react)80 ms51.8 ms+54.26%
Simulationclient-search-params navigation loop (react)59.4 ms47.1 ms+26.14%
Simulationssr rewrite localized (react)89 ms75.3 ms+18.2%
Simulationclient-search-params navigation loop (vue)80.5 ms68.4 ms+17.63%
Simulationclient-links navigation loop (react)90.6 ms77.2 ms+17.41%
Simulationclient-search-params navigation loop (solid)114.8 ms99.9 ms+14.93%
Simulationssr request loop (solid)158 ms144.4 ms+9.41%
Simulationssr rewrite passthrough (react)114.1 ms104.6 ms+9.08%
Simulationclient-links navigation loop (vue)163.9 ms150.5 ms+8.92%
Simulationssr rewrite localized (solid)126.6 ms117 ms+8.17%
Simulationclient-side navigation loop (react)41.2 ms38.1 ms+8.05%
Simulationssr request loop (vue)270.2 ms254.9 ms+6%
Memorymem client preload-churn (vue)776.2 KB735.3 KB+5.57%
Simulationclient-rewrites navigation loop (react)44.6 ms42.4 ms+5.21%
Simulationclient-rewrites navigation loop (vue)48.1 ms45.9 ms+4.77%
Simulationclient-side navigation loop (vue)70.1 ms67 ms+4.6%
Simulationclient-side navigation loop (solid)88 ms84.4 ms+4.26%
Simulationssr rewrite localized (vue)214.6 ms206.9 ms+3.74%
Memorymem server serialization-payload (solid)3.5 MB3.4 MB+3.51%
..................

ℹ️ 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 agent/search-params-skip-json-parse (e86a0d5) with main (c568caf)

Open in CodSpeed

@Sheraff
Sheraff marked this pull request as ready for review August 8, 2026 17:14
@Sheraff
Sheraff merged commit 44a8c3e into mainAug 8, 2026
26 checks passed
@Sheraff
Sheraff deleted the agent/search-params-skip-json-parse branch August 8, 2026 17:43
@github-actionsgithub-actionsBot mentioned this pull request Aug 8, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Sheraff