perf(runtime): bound Read line-index memory to the page #5461
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 288 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.339
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5461"
general
weight: 0.35
seekskyworld
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:
| Source | First-read median / p95, before → after | Median process peak RSS, before → after |
| --- | --- | --- |
| 1M × 32-byte lines | 26.54/30.12 → 22.41/23.21 ms | 184.41 → 149.36 MiB |
| 8M × 2-byte lines (stress) | 110.21/124.18 → 74.61/77.97 ms | 337.55 → 115.73 MiB |
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?