Skip to content

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

Draft
Sheraff wants to merge 1 commit into
mainfrom
perf/task8-wildcard-suffix-offsets
Draft

perf(router-core): wildcard suffix offset comparison#8147
Sheraff wants to merge 1 commit 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: a7f886ea-1a1c-45aa-be93-e823f4c900f6

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

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: 816ddd2b6c39
  • Measured at: 2026-08-21T21:58:03.345Z
  • Baseline source: history:cb281d70c1f5
  • Dashboard: bundle-size history

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

Scenario Current (gzip) Delta vs baseline Initial gzip Raw Brotli Trend
react-router.minimal 83.87 KiB +18 B (+0.02%) 83.73 KiB 262.84 KiB 72.99 KiB ▄▄▃▃▁▁▄▄▄▂▆█
react-router.full 87.37 KiB +20 B (+0.02%) 87.23 KiB 274.55 KiB 76.02 KiB ▃▃▂▂▁▁▅▅▅▃▅█
solid-router.minimal 33.21 KiB +11 B (+0.03%) 33.08 KiB 96.69 KiB 29.98 KiB ▁▁▁▁▆▆▇▇▇▆▇█
solid-router.full 38.04 KiB +12 B (+0.03%) 37.92 KiB 111.33 KiB 34.28 KiB ▁▁▁▁▆▆███▇▇█
vue-router.minimal 49.55 KiB +20 B (+0.04%) 49.43 KiB 138.73 KiB 44.79 KiB ▁▁▁▁▁▁▆▆▆▃▅█
vue-router.full 55.17 KiB +27 B (+0.05%) 55.04 KiB 156.93 KiB 49.71 KiB ▁▁▁▁▁▁▅▅▅▃▅█
react-start.minimal 96.77 KiB +28 B (+0.03%) 96.63 KiB 305.12 KiB 83.87 KiB ▂▂▁▁▅▅▆▆▆▅▇█
react-start.deferred-hydration 97.49 KiB +27 B (+0.03%) 96.65 KiB 306.47 KiB 84.51 KiB ▂▂▁▁▅▅▆▆▆▆▇█
react-start.full 99.93 KiB +17 B (+0.02%) 99.79 KiB 314.85 KiB 86.60 KiB ▁▁▁▁▄▄▆▆▆▅▇█
react-start.rsbuild.minimal 100.07 KiB +18 B (+0.02%) 99.90 KiB 315.39 KiB 86.33 KiB ▂▂▁▁▄▄███▆▇█
react-start.rsbuild.minimal-iife 100.48 KiB +18 B (+0.02%) 100.31 KiB 316.32 KiB 86.71 KiB ▂▂▁▁▄▄███▆▇█
react-start.rsbuild.full 103.39 KiB +15 B (+0.01%) 103.22 KiB 325.48 KiB 89.13 KiB ▂▂▁▁▄▄███▆▇█
solid-start.minimal 46.05 KiB +13 B (+0.03%) 45.93 KiB 137.81 KiB 40.96 KiB ▁▁▁▁▆▆▇▇▇▇██
solid-start.deferred-hydration 49.13 KiB +17 B (+0.03%) 45.99 KiB 145.26 KiB 43.79 KiB ▁▁▁▁▆▆▇▇▇▆▇█
solid-start.full 51.14 KiB +16 B (+0.03%) 51.01 KiB 153.19 KiB 45.35 KiB ▁▁▁▁▆▆▇▇▇▆▇█
vue-start.minimal 65.70 KiB +17 B (+0.03%) 65.57 KiB 189.59 KiB 58.43 KiB ▁▁▁▁▆▆▇▇▇▆▇█
vue-start.full 69.53 KiB +20 B (+0.03%) 69.41 KiB 201.89 KiB 61.76 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.

@nx-cloud

nx-cloud Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 2121491

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

☁️ Nx Cloud last updated this comment at 2026-08-21 22:08:28 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: 2121491

@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 regress 6 benchmarks

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

⚡ 5 improved benchmarks
❌ 6 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 streaming-peak chunked (solid) 30.6 MB 33.5 MB -8.78%
Memory mem client navigation-churn (solid) 589.5 KB 623.6 KB -5.46%
Memory mem server server-fn-churn (vue) 345.7 KB 365 KB -5.28%
Memory mem server error-paths redirect (react) 296.3 KB 309 KB -4.1%
Simulation client-async-pipeline navigation loop (react) 102.8 ms 107.1 ms -4.01%
Memory mem server error-paths not-found (solid) 570 KB 591.1 KB -3.57%
Memory mem server error-paths not-found (vue) 2,071.7 KB 490.4 KB ×4.2
Memory mem server error-paths unmatched (react) 1,830.3 KB 439.1 KB ×4.2
Memory mem server request-churn (react) 712.7 KB 666.1 KB +7%
Memory mem server error-paths redirect (vue) 423.5 KB 401.4 KB +5.51%
Memory mem server aborted-requests (react) 865.1 KB 838.7 KB +3.14%

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 (2121491) with main (cb281d7)

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