perf: skip content cache beyond 1000 files — 7% RSS reduction (#208)#260
Merged
justrach merged 1 commit intorelease/v0.2.57from Apr 13, 2026
Merged
perf: skip content cache beyond 1000 files — 7% RSS reduction (#208)#260justrach merged 1 commit intorelease/v0.2.57from
justrach merged 1 commit intorelease/v0.2.57from
Conversation
During cold indexing, commitParsedFileOwnedOutline duped ALL file contents into a HashMap. On openclaw (13K files) this added ~170MB of peak RSS for content alone. The indexes (word, trigram) consume the content parameter directly — the cache is only needed for readContentForSearch which already has a disk fallback. Skip content storage when outline count > 1000. First 1000 files stay cached for fast search; beyond that, search falls back to disk reads. Snapshot fast-load uses OUTLINE_STATE (not CONTENT), so startup is unaffected. Benchmark (openclaw, 13,867 files, cold search): v0.2.56: 3,678MB peak RSS 6.16s pre-clock: 3,559MB peak RSS 5.66s skip-cache: 3,415MB peak RSS 6.07s (-7.2% RSS vs baseline) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Benchmark Regression ReportThreshold: 10.00%
|
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
During cold indexing,
commitParsedFileOwnedOutlineduplicated ALL file contents into a HashMap. The indexes (word, trigram, sparse) consume thecontentparameter directly — the cache was only needed forreadContentForSearchwhich already falls back to disk.Skip content storage when
outlines.count() > 1000. First 1000 files stay cached for fast search; beyond that, search uses disk reads. Snapshot fast-load usesOUTLINE_STATE(notCONTENT), so startup is unaffected.Benchmark (openclaw, 13,867 files, cold search)
Content cache accounts for ~170MB. Remaining ~3.3GB is from trigram index posting lists — would need flat array (#208 original scope) or compressed postings for further reduction.
Test plan
readContentForSearchdisk fallback verified working🤖 Generated with Claude Code