Loole: A safe async/sync multi-producer, multi-consumer channel

Hi,

I've developed a high-performance MPMC channel crate called Loole. This library offers a way to efficiently communicate between threads/tasks using channels.

Please take a look at this and let me know what you think.

Key Advantages:

  • Fast: Excels in high-contention environments with many concurrent producers and consumers. (Benchmark results are available in the GitHub repo)
  • Featureful: Unbounded, bounded and rendezvous channels
  • Safe: No unsafe code: #![forbid(unsafe_code)]!
  • Capable: Send and receive operations can be blocking (sync) or non-blocking (async)
  • Familiar: Compatible with the Flume's API
  • Simple: No dependencies, fast to compile

Please feel free to share your thoughts or any suggestions for improvement. I'm here to learn from the Rust community and make this library a valuable tool.

Thanks,

Mahdi Shojaee

3 Likes

I have a few questions:

  1. Why no benchmarks for the unbounded channels?
  2. Why 264 bytes?
  3. Why 5000 senders? expecially for the non-async blocking case, this would only happen if you have 5000 actual OS threads, which seems like quite a lot.
1 Like

Thank you for your good questions! Let's address them one by one:

1. Unbounded Channel Benchmarks:

You're right, benchmarks for unbounded channels are missing. I intentionally omitted them from the README to keep it concise. Additionally, Unbounded channel benchmarks require a separate implementation (not done yet).

2. Payload Size (264 bytes):

I chose 264 bytes to simulate a medium-sized payload, something more substantial than just an integer. This helps evaluate performance with more realistic data.

3. Number of Senders (5000):

This is a valid point. 5,000 senders are indeed a high number for the non-async blocking case. My intention was to simulate a scenario with high contention for the channel.

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.