Crates.io | unsync_channel |
lib.rs | unsync_channel |
version | 0.1.0 |
source | src |
created_at | 2023-09-04 21:19:41.085182 |
updated_at | 2023-09-04 21:19:41.085182 |
description | !Send/!Sync channels for Rust |
homepage | |
repository | https://github.com/mmastrac/unsync_channel |
max_upload_size | |
id | 963663 |
size | 15,006 |
A !Sync
, !Send
channel designed for maximum throughput on single-threaded runtimes.
A single-producer, single-consumer, single-item channel. Benchmarks suggest that this has much lower overhead than
tokio::sync::mpsc::channel
: in the case of a LocalSet
sending and receiving between two tasks, it
takes about 75ns to send 10 items. For the equivalent tokio channel, it takes approximately 412ns.
Using the try_send and try_recv APIs, this queue takes 13ns to send and receive an item, versus 399ns for the equivalent tokio channel.
Note that this channel has room for one and only one item. Should the item in the channel be unreceived, send attempts will block. As this is a SPSC-style channel, however, fairness is not a concern.