⚡ Bolt: Fix serialized actor bottlenecks in parallel scanners#31
⚡ Bolt: Fix serialized actor bottlenecks in parallel scanners#31
Conversation
Co-authored-by: acebytes <2820910+acebytes@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What: Converted
CacheScannerandNodeModulesScannerfromactortostructand made their internal methods synchronous without actor isolation.🎯 Why: While both scanners used
withTaskGroupto attempt parallel directory traversal across multiple CPU cores, theiractorisolation forced the child tasks to jump back to the actor's serialized execution context to perform the actual synchronous file I/O. This effectively serialized all the disk scanning operations, running them one by one. Since neither scanner maintains mutable state andFileManager.defaultis thread-safe for these operations, converting tostructallows the child tasks to truly run in parallel.📊 Impact: Significantly improves scanning speed, especially for developers with many
node_modulesfolders or large caches, by utilizing all available CPU cores for disk traversal rather than serializing them on a single actor.🔬 Measurement: Profile the application before and after. Notice that CPU core utilization spikes to 100% across multiple cores during a scan, whereas previously it would be constrained. Scanning large directories like
~/.npmand recursive node_modules will complete visibly faster.PR created automatically by Jules for task 6796066008954764646 started by @acebytes