Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
coroutine/generator: introduce buffered generator for batch processing
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