Skip to content

⚡ Bolt: optimize concurrency with structs and sliding windows#66

Open
acebytes wants to merge 1 commit intomainfrom
bolt-sliding-window-concurrency-14520363108491777627
Open

⚡ Bolt: optimize concurrency with structs and sliding windows#66
acebytes wants to merge 1 commit intomainfrom
bolt-sliding-window-concurrency-14520363108491777627

Conversation

@acebytes
Copy link
Copy Markdown
Contributor

@acebytes acebytes commented Apr 1, 2026

💡 What:

  • Changed CacheScanner and NodeModulesScanner from actor to struct
  • Updated ProcessMemoryScanner.scanPIDs to use a sliding window with an iterator rather than breaking pids into statically sized chunks for the task group.

🎯 Why:

  • actors run child tasks sequentially on a single executor due to context inheritance. Converting them to stateless structs allows parallel task execution for I/O bound scans.
  • Static chunking in ProcessMemoryScanner meant a new chunk couldn't start until the slowest task in the current chunk finished (tail latency problem), leaving the thread pool underutilized. A sliding window keeps exactly maxConcurrency tasks in flight at all times.

📊 Impact:

  • Expected to significantly reduce total scan times by maintaining full concurrency during intensive process scans and disk traversal.

🔬 Measurement:

  • Time the execution of ProcessMemoryScanner.scan(topN:) or the global scan over high-density node_modules projects and observe reduced total processing time compared to trunk.

PR created automatically by Jules for task 14520363108491777627 started by @acebytes

Refactored `CacheScanner` and `NodeModulesScanner` to `struct` to bypass actor executor bottleneck, enabling true parallel execution across threads for stateless operations.
Changed `ProcessMemoryScanner.scanPIDs` to use a sliding window instead of static chunks, ensuring optimal throughput by keeping active tasks near the maximum allowed concurrency rather than waiting for entire chunks to finish.

Co-authored-by: acebytes <2820910+acebytes@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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.

1 participant