jox icon indicating copy to clipboard operation
jox copied to clipboard

Support micro batching in channels

Open asarkar opened this issue 7 months ago • 1 comments

It'd be nice to be able to receive (or send) multiple values at once from the channel, something like channel.receive(n). For the case when n elements are not available, there could be an overloaded version channel.receive(n, duration) and even channel.receive(n, shouldBlock); shouldBlock=false would immediately return a batch with fewer than n elements.

asarkar avatar May 19 '25 21:05 asarkar

I would have to re-check with the paper basing on which the channels algorithm is implemented, but I think that a channel.receive(n) would amount to calling receive n-times. That is, no optimization of the multi-receive is actually possible, you'd have to execute the receive algorithm n times.

adamw avatar May 21 '25 15:05 adamw