Skip to content

⚡ Bolt: Replace actors with structs for truly parallel file scanning#56

Open
acebytes wants to merge 1 commit intomainfrom
bolt/parallel-taskgroup-struct-3269976156032958516
Open

⚡ Bolt: Replace actors with structs for truly parallel file scanning#56
acebytes wants to merge 1 commit intomainfrom
bolt/parallel-taskgroup-struct-3269976156032958516

Conversation

@acebytes
Copy link
Copy Markdown
Contributor

💡 What: Replaced actor with struct for CacheScanner and NodeModulesScanner.
🎯 Why: In Swift's structured concurrency, running withTaskGroup inside an actor causes its child tasks to inherit the actor's isolation context. When tasks invoke synchronous blocking I/O (like FileManager), this inadvertently serializes execution and prevents actual parallelism. Changing these stateless components to structs lets the tasks execute concurrently on the global executor.
📊 Impact: Significantly improves parallel scanning speed for both node_modules and generic cache folders by unlocking true concurrent background execution.
🔬 Measurement: Compare scan completion times before and after for heavy node_modules folders. Also, added a note to .jules/bolt.md reflecting this specific Swift concurrency pitfall.


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

In Swift's structured concurrency, using `actor` to isolate a `withTaskGroup` inadvertently serializes its child tasks if they inherit the actor context.

Since `CacheScanner` and `NodeModulesScanner` only rely on thread-safe dependencies (`FileManager`), converting them to `struct`s prevents this serialization and allows parallel file-system scanning as originally intended.

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