Loole Save Abandoned

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

Project README

Loole

A safe async/sync multi-producer multi-consumer channel.

Github Actions Documentation Cargo License

Producers can send and consumers can receive messages asynchronously or synchronously:

  • sync -> sync
  • async -> async
  • sync -> async
  • async -> sync
fn main() {
    let (tx, rx) = loole::unbounded();

    std::thread::spawn(move || {
        for i in 0..10 {
            tx.send(i).unwrap();
        }
    });

    let mut sum = 0;
    while let Ok(i) = rx.recv() {
        sum += i;
    }

    assert_eq!(sum, (0..10).sum());
}

Usage

To use Loole, place the following line under the [dependencies] section in your Cargo.toml:

loole = "0.1.7"

Run Benchmarks

Benchmarks measure throughput, which is the number of messages sent and received per second, for messages of 264 bytes each.

To run benchmarks on your local machine, run the following command:

Prior to executing this command, ensure Node.js is installed.

cargo run --release -p benchmark

The above command will generate and update the benchmark images in the README.md file.

Benchmark Results

Benchmark results on Intel Core i7-13700K (16/24-core/thread) processor:

MPSC

Measures: Messages per second. (higher is better)

Messages size: 264 bytes.

MPSC: sync-sync MPSC: async-async MPSC: async-sync MPSC: sync-async

MPMC

Measures: Messages per second. (higher is better)

Messages size: 264 bytes.

MPMC: sync-sync MPMC: async-async MPMC: async-sync MPMC: sync-async

SPSC

Measures: Messages per second. (higher is better)

Messages size: 264 bytes.

SPSC: sync-sync SPSC: async-async SPSC: async-sync SPSC: sync-async

License

Loole is licensed under either of:

Open Source Agenda is not affiliated with "Loole" Project. README Source: mahdi-shojaee/loole
Stars
67
Open Issues
0
Last Commit
7 months ago
License

Open Source Agenda Badge

Open Source Agenda Rating