Uh oh!
There was an error while loading. Please reload this page.
perf(router-core): skip impossible JSON parse attempts - #8006
Conversation
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe search parameter serializer now avoids impossible ChangesSearch serialization
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
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
View your CI Pipeline Execution ↗ for commit e86a0d5
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview1 package(s) bumped directly, 22 bumped as dependents. 🟩 Patch bumps
|
Bundle Size Benchmarks
The following scenarios have bundle-size changes compared with the baseline:
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. |
Merging this PR will degrade performance by 0.36%
|
Uh oh!
There was an error while loading. Please reload this page.
What changed
JSON.parsewhen a string's first character cannot begin valid JSONJSON.parseWhy
The default search serializer probes every string with
JSON.parseso 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:
react-router.minimalchanges 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)tests/searchParams.bench.tsrunreact-router.minimalbundle-size scenario onmainand this branchgit diff --checkSummary by CodeRabbit
Bug Fixes
Performance
Tests