Skip to content

perf(file_memory): stop re-reading every file map on each poll (2.158.1) - #225

Merged
drknowhow merged 1 commit into
mainfrom
perf/file-memory-fast-paths
Oct 21, 2026
Merged

drknowhow merged 1 commit into
mainfrom
perf/file-memory-fast-paths

Conversation

@drknowhow

Copy link
Copy Markdown
Owner

list_tracked() JSON-loaded every record in .c3/file_memory to read its path, and FileMemory (on any watcher change) and BranchWatch (every 30 s) called it on timers. On the Yep project that is 64,126 records (292 MB) per call, 92% of them maps of files in nested checkouts; its 14 MCP servers used about 4.5 CPU cores between them. list_tracked() now lists the store and reads only names it has not seen (a record's filename is the md5 of its path). BranchWatch checks each dirty file with the new is_tracked(), and the stale scan skips nested checkouts, which the watcher never reports. 2.158.1.

Ran: tests/test_file_memory_fast_paths.py (4 of 6 fail on the old code) and the full suite locally, 4,815 passed; 4 files fail to import here because a stray tests package in site-packages shadows the repo's.

list_tracked() JSON-loaded every record to read its path, and FileMemory and
BranchWatch called it on timers: 64,126 records (292 MB) per call on the Yep
project, 92% of them maps inside nested checkouts. It now reads only records
it has not seen; BranchWatch uses is_tracked() per dirty file; the stale scan
skips nested checkouts. Tests: tests/test_file_memory_fast_paths.py (4 of 6
fail on the old code).
@drknowhow
drknowhow merged commit 2c1bcf7 into main Oct 21, 2026
12 checks passed
@drknowhow
drknowhow deleted the perf/file-memory-fast-paths branch October 21, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants