Use @streamparser/json if the input is too large to fit in a V8 string#6016
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6016 +/- ##
==========================================
- Coverage 83.79% 83.77% -0.02%
==========================================
Files 329 329
Lines 34395 34423 +28
Branches 9514 9627 +113
==========================================
+ Hits 28821 28839 +18
- Misses 5145 5155 +10
Partials 429 429 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fatadel
left a comment
There was a problem hiding this comment.
Looks good to me personally, but Claude found a minor issue:
V8_STRING_MAX_SIZE is slightly above the actual V8 limit. The constant is 512 * 1024 * 1024 - 1 = (1 << 29) - 1 = 536870911. V8's String::kMaxLength under pointer compression (the typical config — buffer.constants.MAX_STRING_LENGTH exposes this in Node) is (1 << 29) - 24 = 536870888. That leaves a ~23-byte window where the size check passes but the ASCII-decoded string would still throw RangeError: Invalid string length. Practically irrelevant, but the fix is trivial: (1 << 29) - 24, or just import buffer.constants.MAX_STRING_LENGTH in Node paths.
|
Hah, oops. |
Changes: [fatadel] Remove unused dependencies from package.json (#6010) [Nazım Can Altınova] Make profiler-cli work in sandboxed environments (#6003) [Markus Stange] Make profiler-edit run profile compacting before writing out the file (#6015) [Markus Stange] Migrate from prettier to oxfmt (#5986) [Markus Stange] Add a --symbolicate-wasm arg to profiler-edit. (#6008) [Markus Stange] Build and upload the cli artifact in PRs (#6020) [Markus Stange] Use @streamparser/json if the input is too large to fit in a V8 string (#6016) [Nazım Can Altınova] Print also the status output right after cli `load` command (#6019) [Nicolas Chevobbe] Update devtools-reps to 0.27.7 (#6030) [Nazım Can Altınova] Include `--search` option in `pq filter push` (#6026) [Nazım Can Altınova] Update all Yarn dependencies (2026-05-20) (#6033) [fatadel] Translate URL track-index state through profile sanitization (#6000) [Markus Stange] Make withSize use a wrapper element so that it can stop calling findDOMNode (#5988) [Markus Stange] Fix dhat importer (#6036) [Nazım Can Altınova] Annotate inlined frames in CLI call trees and stacks (#6041) [Nazım Can Altınova] Use proper types in cli tests instead of custom inline types (#6038) [Nazım Can Altınova] Fix text truncation for frames named after Object.prototype methods (#6044) [Nazım Can Altınova] Add missing key props to CodeErrorOverlay error list items (#6047) [depfu[bot]] ⬆️ Update oxfmt to version 0.51.0 (#6054) [Nazım Can Altınova] 🔃 Sync: l10n -> main (May 26, 2026) (#6058) [Nazım Can Altınova] Use URL-state symbol server for `profiler-cli function annotate` (#6051) [Nazım Can Altınova] Bump profiler-cli version to 0.2.0 (#6059) And special thanks to our localizers: fr: YD sr: Марко Костић (Marko Kostić) tr: Ali Demirtaş zh-CN: Olvcpr423 zh-CN: wxie
Here's a file which decompresses to a 605.8MB JSON string: large-speedometer3-profile.json.gz
Loading this file in Chrome, or in node via profiler-edit, fails due to the string size.
As a workaround we can use a streaming JSON parser which doesn't materialize a string for the entire thing.