crossbeam-channel Documentation

Multi-producer multi-consumer channels for message passing

331 stars Rust Rust 2 files ยท ~635 tokens
RAW Doc

Technical Documentation: crossbeam-rs/crossbeam-channel

โ„น๏ธ Provenance: Multi-Tier Ingestion ยท CodeWiki Reference

Overview (`README.md`)

NOTE: This crate has been moved into the [crossbeam](https://github.com/crossbeam-rs/crossbeam) repository.

Do not use this repository.

Multi-producer multi-consumer channels for message passing




This library is an alternative to std::sync::mpsc with more features and better performance.

Usage

Add this to your Cargo.toml:

toml
[dependencies]
crossbeam-channel = "0.3"

Next, add this to your crate:

rust
#[macro_use]
extern crate crossbeam_channel;

The minimum required Rust version is 1.26.

License

Licensed under the terms of MIT license and the Apache License (Version 2.0).

See LICENSE-MIT and LICENSE-APACHE for details.


Overview (`benchmarks/README.md`)

Benchmarks

Tests

  • seq: A single thread sends N messages. Then it receives N messages.
  • spsc: One thread sends N messages. Another thread receives N messages.
  • mpsc: T threads send N / T messages each. One thread receives N messages.
  • mpmc: T threads send N / T messages each. T other threads receive N / T messages each.
  • select_rx: T threads send N / T messages each into a separate channel. Another thread receives N messages by selecting over the T channels.
  • select_both: T threads send N / T messages each by selecting over T channels. T other threads receive N / T messages each by selecting over the T channels.

Default configuration:

  • N = 5000000
  • T = 4

Running

Runs benchmarks, stores results into *.txt files, and generates plot.png:

text
./run_all.sh

Dependencies:

  • Rust (nightly)
  • Go
  • Bash
  • Python 2
  • Matplotlib

Results

Machine: Intel(R) Core(TM) i7-5600U (2 physical cores, 4 logical cores)

Rust: rustc 1.30.0-nightly (90d36fb59 2018-09-13)

Go: go version go1.10.3 linux/amd64

Commit: 6cde88a (2018-09-17)


--- METRICS ---