Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Decision: [#257](https://github.com/apache/asyncband/pull/257).

## Documentation

Keep each Markdown prose paragraph and list item on one source line.
Keep each Markdown prose paragraph and list item on one source line. Format Markdown tables so their columns and separators align in the source.

## Changelog

Expand Down
22 changes: 0 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ cargo_metadata = { version = "0.23.1" }
clap = { version = "4.6.5" }
divan = { version = "0.1.21" }
flume = { version = "0.12.0", default-features = false }
pollster = { version = "1.0.1" }
semver = { version = "1.0.28" }
serde = { version = "1.0.229" }
tokio = { version = "1.53.1" }
Expand Down
1 change: 0 additions & 1 deletion benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ asyncband = { workspace = true, features = [
] }
divan = { workspace = true }
flume = { workspace = true, features = ["async"] }
pollster = { workspace = true }
tokio = { workspace = true, features = ["rt-multi-thread", "sync"] }
waitgroup = { workspace = true }

Expand Down
4 changes: 4 additions & 0 deletions benchmarks/asyncband/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ mod condvar;
mod event;
mod latch;
mod mpmc;

#[allow(dead_code)]
#[path = "../mpmc/mod.rs"]
mod mpmc_support;
mod mpsc;
mod mutex;
mod once;
Expand Down
42 changes: 24 additions & 18 deletions benchmarks/asyncband/mpmc/bounded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,41 @@
// specific language governing permissions and limitations
// under the License.

use asyncband::mpmc;
use divan::Bencher;
use divan::counter::ItemsCount;

use super::support::BATCH_MESSAGES;
use super::support::BOUNDED_CAPACITY;
use super::support::ConcurrentBatch;
use super::support::TOPOLOGIES;
use super::support::Topology;
use crate::mpmc_support::adapters::Asyncband;
use crate::mpmc_support::support::BATCH_MESSAGES;
use crate::mpmc_support::support::BOUNDED_CAPACITY;
use crate::mpmc_support::support::Bounded;
use crate::mpmc_support::support::TOPOLOGIES;
use crate::mpmc_support::support::TaskBatch;
use crate::mpmc_support::support::ThreadBatch;
use crate::mpmc_support::support::Topology;
use crate::mpmc_support::support::runtime;

fn send(sender: &mpmc::BoundedSender<usize>, value: usize) {
pollster::block_on(sender.send(value)).expect("benchmark sender disconnected");
}

fn recv(receiver: &mpmc::BoundedReceiver<usize>) -> usize {
pollster::block_on(receiver.recv()).expect("benchmark receiver disconnected")
#[divan::bench(
args = TOPOLOGIES,
sample_count = 20,
sample_size = 1,
counter = ItemsCount::new(BATCH_MESSAGES),
)]
fn blocking_threads(bencher: Bencher, topology: Topology) {
bencher
.with_inputs(|| ThreadBatch::new_bounded::<Asyncband>(BOUNDED_CAPACITY, topology))
.bench_local_refs(|batch| batch.run());
}

#[divan::bench(
consts = [0, 4],
args = TOPOLOGIES,
sample_count = 20,
sample_size = 1,
counter = ItemsCount::new(BATCH_MESSAGES),
)]
fn concurrent(bencher: Bencher, topology: Topology) {
fn tokio_tasks<const WORKERS: usize>(bencher: Bencher, topology: Topology) {
let runtime = runtime(WORKERS);
bencher
.with_inputs(|| {
let (sender, receiver) = mpmc::bounded(BOUNDED_CAPACITY);
ConcurrentBatch::new(sender, receiver, topology, send, recv)
})
.bench_local_refs(|batch| batch.run());
.with_inputs(|| TaskBatch::new::<Bounded<Asyncband>>(&runtime, topology))
.bench_local_refs(|batch| runtime.block_on(batch.run()));
}
1 change: 0 additions & 1 deletion benchmarks/asyncband/mpmc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@
// under the License.

mod bounded;
mod support;
mod unbounded;
139 changes: 0 additions & 139 deletions benchmarks/asyncband/mpmc/support.rs

This file was deleted.

40 changes: 23 additions & 17 deletions benchmarks/asyncband/mpmc/unbounded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,40 @@
// specific language governing permissions and limitations
// under the License.

use asyncband::mpmc;
use divan::Bencher;
use divan::counter::ItemsCount;

use super::support::BATCH_MESSAGES;
use super::support::ConcurrentBatch;
use super::support::TOPOLOGIES;
use super::support::Topology;
use crate::mpmc_support::adapters::Asyncband;
use crate::mpmc_support::support::BATCH_MESSAGES;
use crate::mpmc_support::support::TOPOLOGIES;
use crate::mpmc_support::support::TaskBatch;
use crate::mpmc_support::support::ThreadBatch;
use crate::mpmc_support::support::Topology;
use crate::mpmc_support::support::Unbounded;
use crate::mpmc_support::support::runtime;

fn send(sender: &mpmc::UnboundedSender<usize>, value: usize) {
sender.send(value).expect("benchmark sender disconnected");
}

fn recv(receiver: &mpmc::UnboundedReceiver<usize>) -> usize {
pollster::block_on(receiver.recv()).expect("benchmark receiver disconnected")
#[divan::bench(
args = TOPOLOGIES,
sample_count = 20,
sample_size = 1,
counter = ItemsCount::new(BATCH_MESSAGES),
)]
fn blocking_threads(bencher: Bencher, topology: Topology) {
bencher
.with_inputs(|| ThreadBatch::new_unbounded::<Asyncband>(topology))
.bench_local_refs(|batch| batch.run());
}

#[divan::bench(
consts = [0, 4],
args = TOPOLOGIES,
sample_count = 20,
sample_size = 1,
counter = ItemsCount::new(BATCH_MESSAGES),
)]
fn concurrent(bencher: Bencher, topology: Topology) {
fn tokio_tasks<const WORKERS: usize>(bencher: Bencher, topology: Topology) {
let runtime = runtime(WORKERS);
bencher
.with_inputs(|| {
let (sender, receiver) = mpmc::unbounded();
ConcurrentBatch::new(sender, receiver, topology, send, recv)
})
.bench_local_refs(|batch| batch.run());
.with_inputs(|| TaskBatch::new::<Unbounded<Asyncband>>(&runtime, topology))
.bench_local_refs(|batch| runtime.block_on(batch.run()));
}
4 changes: 4 additions & 0 deletions benchmarks/ecosystem/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

mod broadcast;
mod mpmc;

#[allow(dead_code)]
#[path = "../mpmc/mod.rs"]
mod mpmc_support;
mod mpsc;
mod waitgroup;
mod watch;
Expand Down
Loading