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
83 changes: 83 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ asyncband = { path = "asyncband" }
hashbrown = { version = "0.17.1", default-features = false }

# Dev dependencies
async-channel = { version = "2.5.0" }
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" }
Expand Down
11 changes: 10 additions & 1 deletion benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ edition.workspace = true
rust-version.workspace = true

[dev-dependencies]
async-channel = { workspace = true }
asyncband = { workspace = true, features = [
"barrier",
"blocking",
Expand All @@ -42,11 +43,19 @@ asyncband = { workspace = true, features = [
"waitgroup",
] }
divan = { workspace = true }
flume = { workspace = true, features = ["async"] }
pollster = { workspace = true }
tokio = { workspace = true, features = ["sync"] }

[[bench]]
harness = false
name = "benchmarks"
path = "main.rs"
path = "asyncband/main.rs"

[[bench]]
harness = false
name = "ecosystem"
path = "ecosystem/main.rs"

[lints]
workspace = true
18 changes: 18 additions & 0 deletions benchmarks/asyncband/barrier/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

mod wait;
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ use asyncband::barrier::Barrier;
use divan::Bencher;
use divan::black_box;

use super::support::bench_context;
use super::support::poll_pending;
use super::support::poll_pinned_ready;
use super::support::poll_ready;
use crate::support::bench_context;
use crate::support::poll_pending;
use crate::support::poll_pinned_ready;
use crate::support::poll_ready;

const PARTICIPANT_COUNTS: &[usize] = &[1, 8, 32];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use std::sync::mpsc;
use std::task::Poll;
use std::task::Waker;
use std::thread;
use std::time::Duration;

use asyncband::blocking::FutureExt as _;
use divan::Bencher;
Expand All @@ -31,15 +30,6 @@ fn ready(bencher: Bencher) {
bencher.bench_local(|| async { black_box(42usize) }.block_on());
}

#[divan::bench]
fn ready_with_timeout(bencher: Bencher) {
bencher.bench_local(|| {
async { black_box(42usize) }
.wait_timeout(Duration::ZERO)
.unwrap()
});
}

#[divan::bench]
fn self_wake(bencher: Bencher) {
bencher.bench_local(|| {
Expand Down
19 changes: 19 additions & 0 deletions benchmarks/asyncband/blocking/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

mod block_on;
mod wait_timeout;
31 changes: 31 additions & 0 deletions benchmarks/asyncband/blocking/wait_timeout.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

use std::time::Duration;

use asyncband::blocking::FutureExt as _;
use divan::Bencher;
use divan::black_box;

#[divan::bench]
fn ready_with_timeout(bencher: Bencher) {
bencher.bench_local(|| {
async { black_box(42usize) }
.wait_timeout(Duration::ZERO)
.unwrap()
});
}
18 changes: 18 additions & 0 deletions benchmarks/asyncband/condvar/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

mod wait;
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ use asyncband::mutex::Mutex;
use divan::Bencher;
use divan::black_box;

use super::support::bench_context;
use super::support::poll_pending;
use super::support::poll_pinned_ready;
use super::support::poll_ready;
use crate::support::bench_context;
use crate::support::poll_pending;
use crate::support::poll_pinned_ready;
use crate::support::poll_ready;

const WAITER_COUNTS: &[usize] = &[1, 8, 32];

Expand Down
18 changes: 18 additions & 0 deletions benchmarks/asyncband/latch/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

mod wait;
6 changes: 3 additions & 3 deletions benchmarks/latch.rs → benchmarks/asyncband/latch/wait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ use asyncband::latch::Latch;
use divan::Bencher;
use divan::black_box;

use super::support::bench_context;
use super::support::poll_pending;
use super::support::poll_pinned_ready;
use crate::support::bench_context;
use crate::support::poll_pending;
use crate::support::poll_pinned_ready;

const WORKER_COUNTS: &[usize] = &[1, 8, 32];

Expand Down
File renamed without changes.
Loading