perf(runtime): bound Read line-index memory to the page - #5461
Open
seekskyworld wants to merge 1 commit into
Open
seekskyworld wants to merge 1 commit into
seekskyworld wants to merge 1 commit into
Conversation
Count total lines without retaining the full file index, and keep only positions inside the bounded response window. Preserve exact range and continuation semantics. Fixes apache#5460 Generated-by: OpenAI Codex Signed-off-by: seekskyworld <djh1813553759@gmail.com>
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.
Summary
A bounded Read page currently allocates one newline offset for every source line, even when requesting only 20 lines. Count total lines with scalar state and retain offsets only within the possible response window. Exact range, continuation-digest, Unicode and response-size semantics remain covered by the existing pager tests.
Fixes #5460
Local synthetic filesystem Read measurements, Node 24.18.1 on macOS arm64, 10 fresh processes per case with warm OS cache:
Before:
cd93f13da; after:57d38d69c. Reproduction, smaller fixtures and warm-run results are in the issue. This removes the full-file index allocation; full input reads, exact line counting and content hashing still scale with source size.Verification
git diff --checkpassed. Runtime is the affected suite; other full workspace suites and Desktop E2E were not rerun for this internal pager change.AI use
Tool(s) and scope: OpenAI Codex inspected the repository, implemented the pager change and tests, measured performance and prepared this contribution. Human review and merge remain with the project maintainers.
Checklist
Does this PR entail a change in behavior?