-
Notifications
You must be signed in to change notification settings - Fork 119
Redundant full-root filesystem scans across concurrent mappers #158
Copy link
Copy link
Closed
Labels
P2Normal priority bug or improvement with limited blast radius.Normal priority bug or improvement with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal priority bug or improvement with limited blast radius.Normal priority bug or improvement with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Problem
Currently, when clawpatch orchestrates the mapping process, it launches all 17 feature mappers concurrently. Three of these mappers — Go, C/C++, and Dotnet — perform full-root filesystem scans (walk(root, [""])) to discover files without any early exit conditions (like checking for .sln or CMakeLists.txt), because they support mapping loose source files.
Because these mappers run in parallel and there is no shared file state, they trigger 3 independent, overlapping filesystem traversals. In large polyglot monorepos (e.g., 50,000+ files), this results in a massive 3x redundant disk I/O overhead (150,000+ lstat calls) just to build the directory tree, causing a significant performance bottleneck during initialization.
Proposed Solution
Introduce a Virtual File System (VFS) Cache to share filesystem I/O across all concurrent mappers:
Memoize raw node:fs calls (readdir, lstat, realpath) using Promise-based Maps inside the MapperContext.
Inject this VFS cache into the shared walk() helper.
Update the Go, C/C++, and Dotnet mappers to pass the VFS cache down to their respective walk calls.
This ensures that the first mapper to traverse a directory pays the actual disk I/O cost, while the subsequent mappers instantly receive the cached memory representation. Language-specific filters (e.g., shouldSkipCOrCppPath) will continue to run normally, but entirely in memory