perf(router-core): gate JSON.parse attempts behind jsonStart guard in parseSearchWith - #8142
perf(router-core): gate JSON.parse attempts behind jsonStart guard in parseSearchWith#8142Sheraff wants to merge 2 commits into
Conversation
|
View your CI Pipeline Execution ↗ for commit b68a1bf
☁️ Nx Cloud last updated this comment at |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
🚀 Changeset Version Preview4 package(s) bumped directly, 19 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 4.62%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | mem server request-churn (react) |
662.6 KB | 2,460.5 KB | -73.07% |
| ❌ | Memory | mem client unique-location-churn (solid) |
265.7 KB | 672 KB | -60.46% |
| ❌ | Memory | mem server peak-large-page (vue) |
1 MB | 1.2 MB | -14.13% |
| ❌ | Memory | mem server peak-large-page (solid) |
1 MB | 1.2 MB | -11.39% |
| ❌ | Memory | mem server aborted-requests (react) |
855.7 KB | 904.9 KB | -5.43% |
| ❌ | Memory | mem server request-churn (solid) |
712.7 KB | 747 KB | -4.58% |
| ❌ | Memory | mem server server-fn-churn (vue) |
345.7 KB | 362.1 KB | -4.53% |
| ❌ | Memory | mem server error-paths not-found (solid) |
557.9 KB | 583.1 KB | -4.33% |
| ❌ | Memory | mem server server-fn-churn (react) |
378.9 KB | 391.8 KB | -3.3% |
| ⚡ | Memory | mem server error-paths not-found (vue) |
2,304.3 KB | 492 KB | ×4.7 |
| ⚡ | Memory | mem server error-paths unmatched (react) |
544.1 KB | 420.2 KB | +29.47% |
| ⚡ | Memory | mem server aborted-requests (vue) |
1,110.1 KB | 1,017.7 KB | +9.08% |
| ⚡ | Memory | mem server peak-large-page (react) |
1.2 MB | 1.1 MB | +8.5% |
| ⚡ | Memory | mem server error-paths redirect (solid) |
382.2 KB | 370.7 KB | +3.1% |
| ⚡ | Memory | mem server error-paths redirect (react) |
318.9 KB | 309.6 KB | +3.03% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing perf/task1-jsonstart-parse-gate (b68a1bf) with main (d83a896)
Summary
parseSearchWithnow skips the try/catchJSON.parseattempt for strings that cannot begin valid JSON, using the samejsonStartguard the stringify side already had (searchParams.ts).parser === JSON.parseso custom parsers (public API) are untouched; false positives still fall through to try/catch — behavior strictly identical.Performance
Parse-side bench (1k-string batches), before → after:
Verification
0/-/fa/tru/unicode/etc.) for JSON.parse and a custom parser.searchParams-parse.bench.ts) + 3 unit tests covering gated/pass-through/custom-parser paths.