Skip to content

perf(router-core): wildcard suffix offset comparison - #8147

Draft
Sheraff wants to merge 2 commits into
mainfrom
perf/task8-wildcard-suffix-offsets
Draft

perf(router-core): wildcard suffix offset comparison#8147
Sheraff wants to merge 2 commits into
mainfrom
perf/task8-wildcard-suffix-offsets

Conversation

@Sheraff

@Sheraff Sheraff commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • getNodeMatch allocated parts.slice(index).join('/') per suffixed-wildcard candidate per stack frame — worst-case quadratic copying during matching.
  • Replaced with an inline integer-offset loop (no helper fn, no offsets array — first attempt cost +57 gz bytes and failed the gate; rewrite fits).

Decision gates

  • Bundle: react-router.minimal gzip 85864 → 85882 (+18 B, within ±20 gate); brotli −34.
  • Worst-case perf (one node, 8 suffixed-wildcard candidates, ~200-char/~46-segment URLs, cache bypassed):
workload before after delta
match miss 0.46 µs 0.17 µs 2.7×
match hit 0.48 µs 0.21 µs 2.3×
realistic ~40-char paths 0.46 µs 0.31 µs 1.5×

(Bench note: an earlier run showed only 9.4% because memoization masked misses; restructured so candidates actually evaluate per frame.)

Correctness

Differential test vs vendored old implementation: 20k+ seeded generated tree/path/fuzzy comparisons + edge cases (case-insensitivity, / in suffix, remainder shorter than suffix, trailing slash) — all identical.
test:unit ✅ (1608 tests) · eslint ✅ · types ✅

Full details: RESULT-perf-task8.md on the branch.

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

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

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fb3e5e17-1996-4018-9961-0a3c9db2a4d0

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: b28dcf8e5b89
  • Measured at: 2026-08-22T06:04:14.329Z
  • Baseline source: history:d83a8964c250
  • Dashboard: bundle-size history

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

Scenario Current (gzip) Initial (gzip) Raw Brotli Trend
react-router.minimal 83.9 KiB
+18 B
83.7 KiB
+19 B
262.8 KiB
+56 B
73.0 KiB
-34 B
▄▃▃▁▁▄▄▄▂▆▆█
react-router.full 87.4 KiB
+20 B
87.2 KiB
+18 B
274.6 KiB
+56 B
76.0 KiB
0 B
▃▂▂▁▁▅▅▅▃▅▅█
solid-router.minimal 33.2 KiB
+11 B
33.1 KiB
+12 B
96.7 KiB
+56 B
30.0 KiB
+18 B
▁▁▁▆▆▇▇▇▆▇▇█
solid-router.full 38.0 KiB
+12 B
37.9 KiB
+14 B
111.3 KiB
+56 B
34.3 KiB
+6 B
▁▁▁▆▆███▇▇▇█
vue-router.minimal 49.6 KiB
+20 B
49.4 KiB
+22 B
138.7 KiB
+56 B
44.8 KiB
+111 B
▁▁▁▁▁▆▆▆▃▅▅█
vue-router.full 55.2 KiB
+27 B
55.0 KiB
+25 B
156.9 KiB
+56 B
49.7 KiB
+63 B
▁▁▁▁▁▅▅▅▃▅▅█
react-start.minimal 96.8 KiB
+28 B
96.6 KiB
+26 B
305.1 KiB
+56 B
83.9 KiB
+60 B
▂▁▁▅▅▆▆▆▅▇▇█
react-start.deferred-hydration 97.5 KiB
+27 B
96.7 KiB
+26 B
306.5 KiB
+56 B
84.5 KiB
+23 B
▂▁▁▅▅▆▆▆▆▇▇█
react-start.full 99.9 KiB
+17 B
99.8 KiB
+15 B
314.9 KiB
+56 B
86.6 KiB
+73 B
▁▁▁▄▄▆▆▆▅▇▇█
react-start.rsbuild.minimal 100.1 KiB
+18 B
99.9 KiB
+18 B
315.4 KiB
+56 B
86.3 KiB
-79 B
▂▁▁▄▄███▆▇▇█
react-start.rsbuild.minimal-iife 100.5 KiB
+18 B
100.3 KiB
+18 B
316.3 KiB
+56 B
86.7 KiB
+40 B
▂▁▁▄▄███▆▇▇█
react-start.rsbuild.full 103.4 KiB
+15 B
103.2 KiB
+15 B
325.5 KiB
+56 B
89.1 KiB
+147 B
▂▁▁▄▄███▆▇▇█
solid-start.minimal 46.1 KiB
+13 B
45.9 KiB
+13 B
137.8 KiB
+56 B
41.0 KiB
+1 B
▁▁▁▆▆▇▇▇▇███
solid-start.deferred-hydration 49.1 KiB
+17 B
46.0 KiB
+17 B
145.3 KiB
+56 B
43.8 KiB
+60 B
▁▁▁▆▆▇▇▇▆▇▇█
solid-start.full 51.1 KiB
+16 B
51.0 KiB
+17 B
153.2 KiB
+56 B
45.3 KiB
+42 B
▁▁▁▆▆▇▇▇▆▇▇█
vue-start.minimal 65.7 KiB
+17 B
65.6 KiB
+18 B
189.6 KiB
+56 B
58.4 KiB
-61 B
▁▁▁▆▆▇▇▇▆▇▇█
vue-start.full 69.5 KiB
+20 B
69.4 KiB
+20 B
201.9 KiB
+56 B
61.8 KiB
+10 B
▁▁▁▅▅▇▇▇▆▇▇█

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.

@nx-cloud

nx-cloud Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 5eb2e2c

Command Status Duration Result
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2m 13s View ↗

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

@pkg-pr-new

pkg-pr-new Bot commented Aug 21, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: 5eb2e2c

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

4 package(s) bumped directly, 19 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/react-router 1.170.31 → 1.170.32 Changeset
@tanstack/router-core 1.171.26 → 1.171.27 Changeset
@tanstack/solid-router 1.170.29 → 1.170.30 Changeset
@tanstack/vue-router 1.170.28 → 1.170.29 Changeset
@tanstack/react-start 1.168.48 → 1.168.49 Dependent
@tanstack/react-start-client 1.168.29 → 1.168.30 Dependent
@tanstack/react-start-rsc 0.1.47 → 0.1.48 Dependent
@tanstack/react-start-server 1.167.36 → 1.167.37 Dependent
@tanstack/router-cli 1.167.32 → 1.167.33 Dependent
@tanstack/router-generator 1.167.32 → 1.167.33 Dependent
@tanstack/router-plugin 1.168.34 → 1.168.35 Dependent
@tanstack/router-vite-plugin 1.167.34 → 1.167.35 Dependent
@tanstack/solid-start 1.168.46 → 1.168.47 Dependent
@tanstack/solid-start-client 1.168.28 → 1.168.29 Dependent
@tanstack/solid-start-server 1.167.35 → 1.167.36 Dependent
@tanstack/start-client-core 1.170.26 → 1.170.27 Dependent
@tanstack/start-plugin-core 1.171.38 → 1.171.39 Dependent
@tanstack/start-server-core 1.169.30 → 1.169.31 Dependent
@tanstack/start-static-server-functions 1.167.31 → 1.167.32 Dependent
@tanstack/start-storage-context 1.167.28 → 1.167.29 Dependent
@tanstack/vue-start 1.168.45 → 1.168.46 Dependent
@tanstack/vue-start-client 1.167.31 → 1.167.32 Dependent
@tanstack/vue-start-server 1.167.35 → 1.167.36 Dependent

@codspeed-hq

codspeed-hq Bot commented Aug 21, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 7.28%

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

⚡ 4 improved benchmarks
❌ 7 regressed benchmarks
✅ 169 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory mem server peak-large-page (react) 1.2 MB 2.1 MB -43.37%
Memory mem server error-paths unmatched (react) 544.1 KB 686.9 KB -20.8%
Memory mem server serialization-payload (solid) 4.4 MB 4.7 MB -6.47%
Memory mem server error-paths not-found (solid) 557.9 KB 593.1 KB -5.94%
Memory mem server request-churn (react) 662.6 KB 691.4 KB -4.17%
Memory mem server server-fn-churn (react) 378.9 KB 394.6 KB -3.98%
Memory mem client navigation-churn (solid) 592.5 KB 616.9 KB -3.95%
Memory mem server error-paths redirect (react) 318.9 KB 291.5 KB +9.42%
Memory mem server aborted-requests (vue) 1.1 MB 1 MB +5.55%
Memory mem server error-paths redirect (solid) 382.2 KB 365 KB +4.7%
Memory mem server serialization-payload (vue) 4.5 MB 4.3 MB +3.28%

Tip

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


Comparing perf/task8-wildcard-suffix-offsets (5eb2e2c) with main (d83a896)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant