Repository navigation
Reuse caller-owned buffers for memory and archive member streams - #1068
Merged
Merged
Conversation
…nto perf/borrow-normalized-shingles
…nto perf/borrow-normalized-shingles
… into perf/borrow-output-values
…perf/caller-owned-streams
This was referenced Nov 3, 2026
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.
Memory-backed and archive-member streams can now fill caller-owned buffers, avoiding per-chunk strings during archive reads. This substantially reduces allocation churn for nested containers while preserving read errors, sparse contents and shared budgets.
AG;DR
Dependency and merge order: #1067 and #1066 are merged. This PR is synchronized directly onto
main; the synchronization changes only test execution allowance and ancestry, preserving the qualified runtime/test/benchmark implementation. Runtime qualification remains pinned to492c1ef635837571d26c5c45b78f7c6ef1776798with the #1065 dependency updates. Local qualification is not a substitute for this PR’s fresh main-based CI.Implementation:
MemoryStreamadvertisesReadInto, copies only the initialized bytes available in the supplied span, and advances its independent cursor once. Owned reads remain supported.MemberStreamexposes the same optional capability with the existing 64 KiB cap and decoder/error handling. Owned reads share the checked path. The existing archive session storage and shared reservation are reused; no new index, seeking, worker, lock, format parser, exception path or host-I/O route is introduced.Qualification and limits:
docs/benchmarks/caller-owned-streams-20261103.mdand its lossless evidence archive. The initial nested warmup omitted depth two and was rejected before accepting any timing row; the qualified matrix uses--archive=all --archive-depth=2.Normal enforcing commit and push hooks are required. Current-head CI determines merge readiness. O19b seeking/index/replay/admission and O19d direct final-buffer filling remain open; the broader performance goal is not complete.
The inherited CI correction raises the Linux benchmark-build limit to 60 minutes after #1067’s cold build plus expression measurements exceeded 30 minutes. Cases, repetitions and correctness checks are unchanged. Full CLI footprint: Linux +2,424 bytes; macOS +640 bytes (unstripped).
MSan integration-test deadline recovery:
//xff/cli:rg_full_testtotimeout = "moderate"(300 seconds), retaining its small resource classification, every test case and all assertions. The exact published runtime plus this test attribute passes the complete suite locally under MSan in 5.4 seconds; private performance prototypes were explicitly excluded and restored afterward.