perf(mapper): cache full-root filesystem scans across concurrent mappers - #159
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 17, 2026, 10:38 PM ET / July 18, 2026, 02:38 UTC. Summary Reproducibility: no. high-confidence runtime reproduction is provided. Source and the PR describe the three concurrent full-root traversal paths, but there is no observed current-main syscall trace or representative live benchmark. Review metrics: 2 noteworthy metrics.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the cache scoped to one Do we have a high-confidence way to reproduce the issue? No high-confidence runtime reproduction is provided. Source and the PR describe the three concurrent full-root traversal paths, but there is no observed current-main syscall trace or representative live benchmark. Is this the best way to solve the issue? Likely yes: a run-scoped cache below the shared traversal helper is a narrow way to remove duplicate raw filesystem work while retaining mapper-specific filters. A live comparison must still confirm that the intended performance gain and traversal behavior hold outside mocks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 041bf4bfd670. Label changesLabel justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (3 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
The Go, C/C++, and Dotnet mappers unconditionally run full-root `walk()` scans in parallel, producing 3x redundant disk I/O in large polyglot monorepos. This introduces a shared Virtual File System (VFS) Cache inside the `MapperContext`. The cache memoizes `readdir`, `lstat`, and `realpath` Promises, ensuring that concurrent mappers hitting the same directories share the exact same I/O operation. Language-specific skip filters now run instantly on the cached memory arrays.
Removes the silent empty-array fallback from readdir so permission errors correctly bubble up. Adds focused cache/error regression coverage.
Co-authored-by: Tanmay-008 <tanmayshirbhayye60@gmail.com>
20e6eea to
b4d0c25
Compare
|
Landed on Tested on exact PR head
The implementation preserves mapper-specific traversal pruning and keeps @Tanmay-008's authored commits, changelog credit, and co-author credit on the final maintainer rewrite. |
Description
Fixes the redundant full-root filesystem traversals reported in #158 while preserving each mapper's existing directory-pruning behavior.
The original Promise-based VFS cache reduced raw calls, but real built-CLI proof showed that retaining
Statsand directory state made mapping slower and more memory-intensive. This revision instead performs one policy-aware traversal per mapping run. Go fallback, C/C++, and .NET receive separate sorted file views from the same physical walk, so their existing skip policies still prune directories beforereaddirandlstatwork.Changes
MapperContext.walk()API and error semantics intact for other consumers.Real behavior proof
Built with
pnpm build, then ran the packaged CLI three times against the same disposable 18,022-file polyglot repository containing Go fallback, C++, and C# inputs:main(041bf4bfd670): 1.27s, 1.28s, 2.43s; peak memory about 157-166 MB.20e6eeaea8e6): 4.42s, 6.04s, 5.83s; peak memory about 176-190 MB.b4d0c256fa61): 1.12s, 1.11s, 1.09s; peak memory about 157-158 MB.All runs mapped the same four features with Go fallback and the C/C++ and .NET mappers active.
Validation
pnpm typecheckpnpm lintpnpm format:checkpnpm testpnpm buildpnpm pack:smokeorigin/main: clean, no accepted/actionable findings (correctness 0.92).Fixes #158