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.

1 Like

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.

3 Likes