From 1fa6f3bc37edcadb5d40d748d96feda0079354f8 Mon Sep 17 00:00:00 2001 From: pragmaxim Date: Tue, 11 Jun 2024 11:23:49 +0200 Subject: [PATCH] readme --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4d70959..1cce4d8 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,12 @@ [![Cargo](https://img.shields.io/crates/v/futures-batch.svg)](https://crates.io/crates/futures-batch) [![Documentation](https://docs.rs/futures-batch/badge.svg)](https://docs.rs/futures-batch) -An adapter that turns elements into a batch of minimal element count. Needed for efficient work -parallelization so that following tasks running in parallel are all processing at least -`min_batch_size` of elements to avoid context switching overhead of cpu intensive workloads. +An adapter that turns elements into a batch and its minimal size is computed by given closure. +It is needed for efficient work parallelization so that following tasks running in parallel +are all processing a batch of at least `min_batch_size` to avoid context switching overhead +of cpu intensive workloads. Otherwise we usually need to introduce some kind of publish/subscribe +model with dedicated long-running thread for each consumer and broadcasting messages to them +and establishing back-pressure through [barrier](https://docs.rs/tokio/latest/tokio/sync/struct.Barrier.html). ## Usage