You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Streaming from channels currently uses drainUpTo on the underlying Queue to grab chunks from the channel. Since there is no queue for zero-capacity channels, they will necessarily stream one element at a time (that is, chunks of size 1 -- essentially a loop over take), even though there may be multiple pending puts that could be drained.
It probably makes sense to provide a special implementation for channels of capacity zero that has no main queue and simply passes values directly from the pending puts to the pending takes. drain and drainUpTo could be specialized to drain the puts. Since there is no queue for these to pass to, there is no issue with ordering to worry about (which is why regular channels only drain the main queue and not the puts).
The text was updated successfully, but these errors were encountered:
Streaming from channels currently uses
drainUpTo
on the underlyingQueue
to grab chunks from the channel. Since there is no queue for zero-capacity channels, they will necessarily stream one element at a time (that is, chunks of size 1 -- essentially a loop overtake
), even though there may be multiple pending puts that could be drained.It probably makes sense to provide a special implementation for channels of capacity zero that has no main queue and simply passes values directly from the pending
puts
to the pendingtakes
.drain
anddrainUpTo
could be specialized to drain the puts. Since there is no queue for these to pass to, there is no issue with ordering to worry about (which is why regular channels only drain the main queue and not theputs
).The text was updated successfully, but these errors were encountered: