#359 ForEach operator runs sequentially, not in parallel

closed high foreach parallel performance Created 2025-12-11 09:00 · Updated 2025-12-11 09:27

Description

Edit
## Problem The ForEachOperator in engine/interpreters/operators.py:614 uses a sequential for loop: for idx, item in enumerate(items): iteration_result = self._execute_loop_body_task(ctx, body_task) This means all iterations run one-by-one, not in parallel. Evidence from arxiv_summarization workflow: - Extract PDF 1: 08:48:24 - Extract PDF 2: 08:48:46 (+22 sec) - Extract PDF 3: 08:49:11 (+25 sec) If parallel, all would start within milliseconds. ## Expected Behavior ForEach should support parallel execution similar to ParallelOperator, which spawns separate workflow branches. ## Options 1. Add parallel mode to ForEach: builder.foreach(..., parallel=True) spawns concurrent branches 2. Document current behavior: ForEach is sequential by design, use ParallelOperator for parallelism 3. Replace ForEach with dynamic ParallelOperator: Transform foreach items into parallel branches at runtime ## Related Issue #358 acceptance test claimed parallel execution but was actually sequential.

Comments

Loading comments...

Context

Loading context...

Audit History

View All
Loading audit history...