#async-channel #channel #async #reduce #values #reading #mpmc

batch-channel

async channel that reduces overhead by reading and writing many values at once

12 releases

0.3.7 Oct 11, 2023
0.3.6 Sep 18, 2023
0.2.2 Aug 16, 2023
0.1.0 Aug 3, 2023

#820 in Asynchronous

MIT license

24KB
468 lines

async MPMC channel that reduces overhead by reading and writing many values at once.

Sometimes large volumes of small values are farmed out to workers through a channel. Consider directory traversal: each readdir() call produces a batch of directory entries. Batching can help the consumption side too. Consider querying SQLite with received values -- larger batches reduce the amortized cost of acquiring SQLite's lock and bulk queries can be issued.

One can imagine natural, currently unimplemented, extensions to this crate:

  • Channels with priority
  • impls for futures::sink::Sink and futures::stream::Stream

Ask if they would be helpful.

Dependencies

~24KB