Repository navigation
Conversation
Collaborator
|
Review requested:
|
`parsePackageJSON()` copies its input into a `std::string` with no spare capacity. `simdjson::pad()` then appends `SIMDJSON_PADDING` spaces, so every call reallocated and copied the whole document. Reserve room for the padding when the input is copied so that the append happens in place. The padding stays within the string's size, so simdjson never reads past the end of the string. Add a benchmark that parses the package.json files under deps/. Assisted-by: an AI coding agent Signed-off-by: Daniel Lemire <daniel@lemire.me>
anonrig
approved these changes
Nov 19, 2026
lemire
force-pushed
the
src-reserve-simdjson-padding
branch
from
November 19, 2026 18:36
9d623d0 to
2e4265a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #67623 +/- ##
=======================================
Coverage 90.71% 90.72%
=======================================
Files 801 801
Lines 280923 280925 +2
Branches 54240 54243 +3
=======================================
+ Hits 254839 254856 +17
+ Misses 16254 16249 -5
+ Partials 9830 9820 -10
🚀 New features to boost your workflow:
|
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
parsePackageJSON()function copies its input into astd::stringwith no sparecapacity. The
simdjson::pad()function then appendsSIMDJSON_PADDINGspaces.This change reserves room for the padding when the input is copied, so the append happens in
place.
This adds
benchmark/module/parse-package-json.js, which parses theunique package.json files under
deps/, grouped by file size.Benchmarks
benchmark/compare.js, 30 runs, old =main(108cbef), new = this PR,Welch's t-test.
Intel Xeon Gold 6548N (Emerald Rapids), Linux, clang 23:
Intel Xeon Gold 6338 (Ice Lake), Linux, clang 23:
Apple M4 Max, macOS, Apple clang 17:
Refs: #55584
Refs: #55591
Refs: #67620