aboutsummaryrefslogtreecommitdiff
path: root/benches
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2021-04-02 10:21:46 -0700
committerJoel Galenson <jgalenson@google.com>2021-04-02 10:33:07 -0700
commitf82068b73854d7dc72e90db3b4e3e230df64e289 (patch)
tree305abc2cbce5f7faefdcb154d24bfeb5eeb18ec0 /benches
parentca75fd7ff2b382a86f2bedc6b96c530ea065e2a8 (diff)
downloadcriterion-f82068b73854d7dc72e90db3b4e3e230df64e289.tar.gz
Upgrade rust/crates/criterion to 0.3.4android-s-beta-2android-s-beta-1
Test: make Change-Id: I6ec05b4cd71419f4dc7699f26d3b610e0bb6e2be
Diffstat (limited to 'benches')
-rwxr-xr-xbenches/bench_main.rs1
-rwxr-xr-xbenches/benchmarks/async_measurement_overhead.rs48
-rwxr-xr-xbenches/benchmarks/compare_functions.rs2
-rwxr-xr-xbenches/benchmarks/iter_with_large_drop.rs2
-rwxr-xr-xbenches/benchmarks/iter_with_large_setup.rs2
-rwxr-xr-xbenches/benchmarks/mod.rs11
6 files changed, 66 insertions, 0 deletions
diff --git a/benches/bench_main.rs b/benches/bench_main.rs
index 3d9859b..a153b23 100755
--- a/benches/bench_main.rs
+++ b/benches/bench_main.rs
@@ -13,4 +13,5 @@ criterion_main! {
benchmarks::measurement_overhead::benches,
benchmarks::custom_measurement::benches,
benchmarks::sampling_mode::benches,
+ benchmarks::async_measurement_overhead::benches,
}
diff --git a/benches/benchmarks/async_measurement_overhead.rs b/benches/benchmarks/async_measurement_overhead.rs
new file mode 100755
index 0000000..0c9605a
--- /dev/null
+++ b/benches/benchmarks/async_measurement_overhead.rs
@@ -0,0 +1,48 @@
+use criterion::{async_executor::FuturesExecutor, criterion_group, BatchSize, Criterion};
+
+fn some_benchmark(c: &mut Criterion) {
+ let mut group = c.benchmark_group("async overhead");
+ group.bench_function("iter", |b| b.to_async(FuturesExecutor).iter(|| async { 1 }));
+ group.bench_function("iter_with_setup", |b| {
+ b.to_async(FuturesExecutor)
+ .iter_with_setup(|| (), |_| async { 1 })
+ });
+ group.bench_function("iter_with_large_setup", |b| {
+ b.to_async(FuturesExecutor)
+ .iter_with_large_setup(|| (), |_| async { 1 })
+ });
+ group.bench_function("iter_with_large_drop", |b| {
+ b.to_async(FuturesExecutor)
+ .iter_with_large_drop(|| async { 1 })
+ });
+ group.bench_function("iter_batched_small_input", |b| {
+ b.to_async(FuturesExecutor)
+ .iter_batched(|| (), |_| async { 1 }, BatchSize::SmallInput)
+ });
+ group.bench_function("iter_batched_large_input", |b| {
+ b.to_async(FuturesExecutor)
+ .iter_batched(|| (), |_| async { 1 }, BatchSize::LargeInput)
+ });
+ group.bench_function("iter_batched_per_iteration", |b| {
+ b.to_async(FuturesExecutor)
+ .iter_batched(|| (), |_| async { 1 }, BatchSize::PerIteration)
+ });
+ group.bench_function("iter_batched_ref_small_input", |b| {
+ b.to_async(FuturesExecutor)
+ .iter_batched_ref(|| (), |_| async { 1 }, BatchSize::SmallInput)
+ });
+ group.bench_function("iter_batched_ref_large_input", |b| {
+ b.to_async(FuturesExecutor)
+ .iter_batched_ref(|| (), |_| async { 1 }, BatchSize::LargeInput)
+ });
+ group.bench_function("iter_batched_ref_per_iteration", |b| {
+ b.to_async(FuturesExecutor).iter_batched_ref(
+ || (),
+ |_| async { 1 },
+ BatchSize::PerIteration,
+ )
+ });
+ group.finish();
+}
+
+criterion_group!(benches, some_benchmark);
diff --git a/benches/benchmarks/compare_functions.rs b/benches/benchmarks/compare_functions.rs
index b3db640..ce44180 100755
--- a/benches/benchmarks/compare_functions.rs
+++ b/benches/benchmarks/compare_functions.rs
@@ -1,3 +1,5 @@
+#![allow(deprecated)]
+
use criterion::{criterion_group, BenchmarkId, Criterion, Fun, ParameterizedBenchmark};
fn fibonacci_slow(n: u64) -> u64 {
diff --git a/benches/benchmarks/iter_with_large_drop.rs b/benches/benchmarks/iter_with_large_drop.rs
index 11de5db..ee9a8e9 100755
--- a/benches/benchmarks/iter_with_large_drop.rs
+++ b/benches/benchmarks/iter_with_large_drop.rs
@@ -1,3 +1,5 @@
+#![allow(deprecated)]
+
use criterion::{criterion_group, Benchmark, Criterion, Throughput};
use std::time::Duration;
diff --git a/benches/benchmarks/iter_with_large_setup.rs b/benches/benchmarks/iter_with_large_setup.rs
index 9cbf51a..217d271 100755
--- a/benches/benchmarks/iter_with_large_setup.rs
+++ b/benches/benchmarks/iter_with_large_setup.rs
@@ -1,3 +1,5 @@
+#![allow(deprecated)]
+
use criterion::{criterion_group, Benchmark, Criterion, Throughput};
use std::time::Duration;
diff --git a/benches/benchmarks/mod.rs b/benches/benchmarks/mod.rs
index 5ff243f..ef85910 100755
--- a/benches/benchmarks/mod.rs
+++ b/benches/benchmarks/mod.rs
@@ -8,3 +8,14 @@ pub mod measurement_overhead;
pub mod sampling_mode;
pub mod special_characters;
pub mod with_inputs;
+
+#[cfg(feature = "async_futures")]
+pub mod async_measurement_overhead;
+
+#[cfg(not(feature = "async_futures"))]
+pub mod async_measurement_overhead {
+ use criterion::{criterion_group, Criterion};
+ fn some_benchmark(_c: &mut Criterion) {}
+
+ criterion_group!(benches, some_benchmark);
+}