perf(workspace): batch deps-cache invalidation into one workspace fs scan#10445
perf(workspace): batch deps-cache invalidation into one workspace fs scan#10445davidfirst wants to merge 3 commits into
Conversation
…scan The deps fs-cache freshness check ran a recursive globby per component that followed each component's node_modules symlink into the shared workspace node_modules (226k of 230k scanned entries), 313x per command. Replace it with a single node_modules-ignoring workspace scan, memoized as a command-scoped mtime index on FsCache and invalidated via the workspace's clear-cache hooks (so watch stays correct), with a per-component fallback. Cuts warm `bit status` fs syscalls ~40% (74.3k -> 44.8k); read traffic unchanged. Warm-wall-neutral on fast SSD (I/O-wait overlapping CPU), a real win on cold/CI/networked filesystems.
Code Review by Qodo
1.
|
PR Summary by Qodoperf(workspace): batch deps-cache invalidation with shared workspace mtime index Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1. Stuck index build promise
|
…nd watch races Address qodo review on the deps-cache invalidation index: - clear the in-flight build promise in `finally`, so a transient build rejection (glob/stat error) no longer poisons all later reads in a long-lived process (watch/start). - in `deleteComponentMtimeIndexEntry`, bump the generation when a build is in-flight, so a watch-triggered clear that races the first build discards that build's result instead of caching the now-stale entry as canonical. - fall back to the per-component scan if the centralized index build throws, preserving fault isolation (one bad dir no longer fails every load).
|
Code review by qodo was updated up to the latest commit db242dc |
Part of the component-loading redesign (
scopes/workspace/workspace/component-loading-redesign.md, Phase 2).The deps fs-cache freshness check ran a recursive
globbyper component that followed each component'snode_modulessymlink into the shared workspacenode_modules— 226k of 230k scanned entries, run 313× per command. This replaces it with a singlenode_modules-ignoring workspace scan, memoized as a command-scoped mtime index onFsCacheand invalidated through the workspace's existing clear-cache hooks (sowatch/startstay correct), with a per-component fallback for entries not in the scan.Measured on this repo's workspace (~313 components): warm
bit statusfilesystem syscalls 74.3k → 44.8k (~40% fewer); thestatFilessub-step dropped 22.3s → 0.15s aggregate;readFiletraffic is unchanged (checked against the bootstrap fs-read e2e metric — no read regression).Warm wall is ~flat on a fast local SSD: the eliminated work is I/O-wait that overlaps with CPU on the single JS thread, so it was never on the warm critical path. The win lands on cold / CI / networked filesystems, where those ~30k syscalls aren't free. §4.1 of the redesign doc is updated with the full breakdown (this also corrects an earlier "object materialization" misread — deserialize is 9ms).