Repository navigation
perf: reduce large-file memory amplification - #2967
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 5b7c021 | Commit Preview URL Branch Preview URL |
Nov 22 2026, 03:10 AM |
chaliy
force-pushed
the
perf/large-file-memory
branch
from
November 22, 2026 03:04
bb12fbc to
ec10f78
Compare
chaliy
force-pushed
the
perf/large-file-memory
branch
from
November 22, 2026 03:09
ec10f78 to
5b7c021
Compare
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.
What changed
Large-file commands retain fewer full-size buffers.
wccomputes only requested counts from raw bytes; jq parses ordinary inputs on demand and generates--streamevents directly from tokens; curl moves response bodies into output. Native curl/wget collection reserves at most 1 MiB for known response lengths.Add
just stress-files 256and five allocation regression checks. Preserve byte integrity, write-out metadata, partial-error output, input locations, raw sequence input, resource limits, and recovery after rejection. Source text and shared shell I/O remain buffered.Why
A 256 MiB JSONL file required approximately 2.9 GiB of extra heap for input reduction or
--stream; full response copies and unrequested text statistics also amplified memory use.Before / After
Conservative peak extra heap for 256 MiB fixtures, excluding preloaded fixtures and persistent state. Successful cases explicitly raise resource limits. HTTP measurements use loopback with content-length and chunked framing.
--streamwc -cthrough input redirectionDirect
wc -c FILEallocation regression: approximately 11 MiB -> 1 MiB for a 1 MiB invalid-UTF-8 file. All 140 workload runs and 35 boundary checks passed across 1, 8, 32, 64, and 256 MiB fixtures.Validation after rebasing on current main:
just pre-pr, including formatting, default Clippy, repository checks, and cargo-vet.just test: 3,993 core unit tests, 2,706 integration tests, six large-file stress/allocation tests, the remaining workspace and documentation tests, and all 19 failpoint tests.cargo clippy --all-targets --all-features -- -D warnings.The final review also covers all scalar control-character boundaries: only SP, HT, LF, and CR delimit JSON values; invalid controls fail before emitting partial scalar output.
Risk
Checklist