Skip to content

perf: buffer par_process result channel to decouple workers - #26

Merged
encounter merged 1 commit into
encounter:mainfrom
rom-weaver:upstream-par-process-buffer
Jul 17, 2026
Merged

encounter merged 1 commit into
encounter:mainfrom
rom-weaver:upstream-par-process-buffer

Conversation

@brandonocasey

Copy link
Copy Markdown
Contributor

Buffer up to one result per worker, allowing processing to continue while the main thread reorders and writes completed blocks.

The result channel used a rendezvous (capacity 0), so a worker that
finished a block blocked until the main thread was ready to receive.
While the main thread reordered and wrote one block, every other worker
stalled. Give the channel `num_threads` slots so each worker drops its
result and immediately picks up the next block, keeping all cores busy.
Memory stays bounded: at most `num_threads` extra blocks in flight.
@brandonocasey
brandonocasey force-pushed the upstream-par-process-buffer branch from 882f4bf to 93e0d5a Compare July 16, 2026 19:29
@encounter

Copy link
Copy Markdown
Owner

Thanks!

@encounter
encounter merged commit 8db65fa into encounter:main Jul 17, 2026
28 of 39 checks passed
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.

2 participants