Skip to content

Commit

Permalink
coroutine/generator: introduce buffered generator for batch processing
Browse files Browse the repository at this point in the history
before this change, we only have an unbuffered generator
implementation, where the producer and consumer operated in a
"ping-pong" fashion. elements were produced and consumed one at a time.

in this change, we introduce a buffered variant of the generator,
which allows producer to yield a range of elements in batch. it
also enables consumer to process multiple elements without suspension.

the benefits are:

* improved efficiency for batch operations
* reduced context switching between producer and consumer
* enhanced flexibility in element production and consumption patterns

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Sep 23, 2024
1 parent f3be1c6 commit b43215b
Show file tree
Hide file tree
Showing 2 changed files with 478 additions and 16 deletions.
Loading

0 comments on commit b43215b

Please sign in to comment.