Hey @papertigers, I just saw your message on IRC, which I am repeating here:
Have you done any testing with sending values at a decently high throughput?
I noticed that sending values relatively quickly through a crossbeam channel results in a lot yields and increased CPU usage compared to std::sync::mpsc
https://play.rust-lang.org/?version=stable&mode=debug&edition=2015&gist=3677d9c50b85252170dc410137d489dd
is a small example that shows what I am talking about
https://gist.github.com/papertigers/0bd33bc0f1241463dcee35763337c579
Thanks for the report! I think it'd be easier to chat either over on GitHub or on our discord channel since we have moved off IRC.
My guess what is going on here is that in std::sync::mpsc, Sender in std::sync::mpsc is slower than its corresponding Receiver so the messages build up and nobody ever has to block.
On the other hand, it may be that in crossbeam-channel, Sender is slower than Receiver so sometimes the Receiver has to block, which is where those yields come from.
Could you perhaps verify if my hypothesis is true?
Hey @papertigers, I just saw your message on IRC, which I am repeating here:
Thanks for the report! I think it'd be easier to chat either over on GitHub or on our discord channel since we have moved off IRC.
My guess what is going on here is that in
std::sync::mpsc,Senderinstd::sync::mpscis slower than its correspondingReceiverso the messages build up and nobody ever has to block.On the other hand, it may be that in
crossbeam-channel,Senderis slower thanReceiverso sometimes theReceiverhas to block, which is where those yields come from.Could you perhaps verify if my hypothesis is true?