Why it's mpsc not spsc for channel

Hi May I ask the design tradeoff for channel, why it's mpsc, spsc should also work nicely, does it against single writer principle?

https://doc.rust-lang.org/std/sync/mpsc/fn.channel.html

A multi-producer channel is more powerful than a single-producer channel.

When the sender is not cloned it does use an efficient SPSC implementation underneath I believe, and it can dynamically switch implementations on the fly.

2 Likes

If you're after efficiency, then you should use:

Despite being mpmc, it's way faster than std in all cases, even when used with just one producer and one consumer.

4 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.