Our channel is pretty unperformant in that we are doing a lot unnecessary work. Two things we are doing that has a pretty massive performance impact.
We are keeping our waiters in a set. The idea here was to deduplicate multiple fibers. The issue is once a fiber is blocked by a channel it will only ever be in that one channel waiting so we shouldn't every have this case
We eagerly remove completed waiters. This again requires a way to efficiently find the fiber in a the list of waiters for removal
Solution
We move our waiters to VecDeque and treat them as simple queues. When we dequeue we now check if the fiber is complete which should be a simple equaity check.
Problem
Our channel is pretty unperformant in that we are doing a lot unnecessary work. Two things we are doing that has a pretty massive performance impact.
Solution
We move our waiters to
VecDeque
and treat them as simple queues. When we dequeue we now check if the fiber is complete which should be a simple equaity check.