Package groovy.transform

# Annotation Interface Parallel

@Incubating @Documented @Retention(SOURCE) public @interface Parallel
Runs each iteration of an annotated `for` loop in parallel using the current pool or default executor, with structured completion.

Uses `Pool.current()` if inside a `ParallelScope.withPool(int, java.util.function.Function<groovy.concurrent.AsyncScope, T>)` block, otherwise falls back to `ForkJoinPool.commonPool()`.

While `@Parallel` provides a convenient way to parallelise `for` loops, using the `*Parallel` collection methods (e.g. `collectParallel`, `eachParallel`) directly may offer a better debugging experience, as `@Parallel` performs internal variable renaming in its generated code.

Blocking loop bodies should run inside `ParallelScope.withPool(n)` (or an I/O pool); see `ParallelCollectionExtensions`.

Since:
  6.0.0
See Also:
  - `ParallelASTTransformation`