diff options
author | Lucio Franco <luciofranco14@gmail.com> | 2020-10-12 13:44:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-12 13:44:54 -0400 |
commit | 8880222036f37c6204c8466f25e828447f16dacb (patch) | |
tree | fd623afc20f73bbce65746a3d1b1b2731ecf30a5 /benches | |
parent | 0893841f31542b2b04c5050a8a4a3c45cf867e55 (diff) |
rt: Remove `threaded_scheduler()` and `basic_scheduler()` (#2876)
Co-authored-by: Alice Ryhl <alice@ryhl.io>
Co-authored-by: Carl Lerche <me@carllerche.com>
Diffstat (limited to 'benches')
-rw-r--r-- | benches/mpsc.rs | 37 | ||||
-rw-r--r-- | benches/scheduler.rs | 5 | ||||
-rw-r--r-- | benches/signal.rs | 4 | ||||
-rw-r--r-- | benches/spawn.rs | 14 | ||||
-rw-r--r-- | benches/sync_rwlock.rs | 21 | ||||
-rw-r--r-- | benches/sync_semaphore.rs | 22 |
6 files changed, 37 insertions, 66 deletions
diff --git a/benches/mpsc.rs b/benches/mpsc.rs index 2f3fe963..3f7e3fca 100644 --- a/benches/mpsc.rs +++ b/benches/mpsc.rs @@ -4,6 +4,13 @@ use tokio::sync::mpsc; type Medium = [usize; 64]; type Large = [Medium; 64]; +fn rt() -> tokio::runtime::Runtime { + tokio::runtime::Builder::new_multi_thread() + .worker_threads(6) + .build() + .unwrap() +} + fn create_1_medium(b: &mut Bencher) { b.iter(|| { black_box(&mpsc::channel::<Medium>(1)); @@ -43,11 +50,7 @@ fn send_large(b: &mut Bencher) { } fn contention_bounded(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .core_threads(6) - .threaded_scheduler() - .build() - .unwrap(); + let rt = rt(); b.iter(|| { rt.block_on(async move { @@ -70,11 +73,7 @@ fn contention_bounded(b: &mut Bencher) { } fn contention_bounded_full(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .core_threads(6) - .threaded_scheduler() - .build() - .unwrap(); + let rt = rt(); b.iter(|| { rt.block_on(async move { @@ -97,11 +96,7 @@ fn contention_bounded_full(b: &mut Bencher) { } fn contention_unbounded(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .core_threads(6) - .threaded_scheduler() - .build() - .unwrap(); + let rt = rt(); b.iter(|| { rt.block_on(async move { @@ -124,11 +119,7 @@ fn contention_unbounded(b: &mut Bencher) { } fn uncontented_bounded(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .core_threads(6) - .threaded_scheduler() - .build() - .unwrap(); + let rt = rt(); b.iter(|| { rt.block_on(async move { @@ -146,11 +137,7 @@ fn uncontented_bounded(b: &mut Bencher) { } fn uncontented_unbounded(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .core_threads(6) - .threaded_scheduler() - .build() - .unwrap(); + let rt = rt(); b.iter(|| { rt.block_on(async move { diff --git a/benches/scheduler.rs b/benches/scheduler.rs index 801de72a..68a6d6a4 100644 --- a/benches/scheduler.rs +++ b/benches/scheduler.rs @@ -139,9 +139,8 @@ fn chained_spawn(b: &mut Bencher) { } fn rt() -> Runtime { - runtime::Builder::new() - .threaded_scheduler() - .core_threads(4) + runtime::Builder::new_multi_thread() + .worker_threads(4) .enable_all() .build() .unwrap() diff --git a/benches/signal.rs b/benches/signal.rs index 3a354c6b..fcad40da 100644 --- a/benches/signal.rs +++ b/benches/signal.rs @@ -45,9 +45,9 @@ fn many_signals(bench: &mut Bencher) { let num_signals = 10; let (tx, mut rx) = mpsc::channel(num_signals); - let rt = runtime::Builder::new() + let rt = runtime::Builder::new_multi_thread() // Intentionally single threaded to measure delays in propagating wakes - .basic_scheduler() + .worker_threads(0) .enable_all() .build() .unwrap(); diff --git a/benches/spawn.rs b/benches/spawn.rs index f76daf3f..72a40357 100644 --- a/benches/spawn.rs +++ b/benches/spawn.rs @@ -10,8 +10,7 @@ async fn work() -> usize { } fn basic_scheduler_local_spawn(bench: &mut Bencher) { - let runtime = tokio::runtime::Builder::new() - .basic_scheduler() + let runtime = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); runtime.block_on(async { @@ -23,8 +22,7 @@ fn basic_scheduler_local_spawn(bench: &mut Bencher) { } fn threaded_scheduler_local_spawn(bench: &mut Bencher) { - let runtime = tokio::runtime::Builder::new() - .threaded_scheduler() + let runtime = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); runtime.block_on(async { @@ -36,8 +34,7 @@ fn threaded_scheduler_local_spawn(bench: &mut Bencher) { } fn basic_scheduler_remote_spawn(bench: &mut Bencher) { - let runtime = tokio::runtime::Builder::new() - .basic_scheduler() + let runtime = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); @@ -48,10 +45,7 @@ fn basic_scheduler_remote_spawn(bench: &mut Bencher) { } fn threaded_scheduler_remote_spawn(bench: &mut Bencher) { - let runtime = tokio::runtime::Builder::new() - .threaded_scheduler() - .build() - .unwrap(); + let runtime = tokio::runtime::Builder::new_multi_thread().build().unwrap(); bench.iter(|| { let h = runtime.spawn(work()); diff --git a/benches/sync_rwlock.rs b/benches/sync_rwlock.rs index 30c66e49..46eeac0c 100644 --- a/benches/sync_rwlock.rs +++ b/benches/sync_rwlock.rs @@ -3,9 +3,8 @@ use std::sync::Arc; use tokio::{sync::RwLock, task}; fn read_uncontended(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .core_threads(6) - .threaded_scheduler() + let rt = tokio::runtime::Builder::new_multi_thread() + .worker_threads(6) .build() .unwrap(); @@ -22,9 +21,8 @@ fn read_uncontended(b: &mut Bencher) { } fn read_concurrent_uncontended_multi(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .core_threads(6) - .threaded_scheduler() + let rt = tokio::runtime::Builder::new_multi_thread() + .worker_threads(6) .build() .unwrap(); @@ -51,8 +49,7 @@ fn read_concurrent_uncontended_multi(b: &mut Bencher) { } fn read_concurrent_uncontended(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .basic_scheduler() + let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); @@ -78,9 +75,8 @@ fn read_concurrent_uncontended(b: &mut Bencher) { } fn read_concurrent_contended_multi(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .core_threads(6) - .threaded_scheduler() + let rt = tokio::runtime::Builder::new_multi_thread() + .worker_threads(6) .build() .unwrap(); @@ -108,8 +104,7 @@ fn read_concurrent_contended_multi(b: &mut Bencher) { } fn read_concurrent_contended(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .basic_scheduler() + let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); diff --git a/benches/sync_semaphore.rs b/benches/sync_semaphore.rs index 32d4aa2b..19a1dd33 100644 --- a/benches/sync_semaphore.rs +++ b/benches/sync_semaphore.rs @@ -3,9 +3,8 @@ use std::sync::Arc; use tokio::{sync::Semaphore, task}; fn uncontended(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .core_threads(6) - .threaded_scheduler() + let rt = tokio::runtime::Builder::new_multi_thread() + .worker_threads(6) .build() .unwrap(); @@ -27,9 +26,8 @@ async fn task(s: Arc<Semaphore>) { } fn uncontended_concurrent_multi(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .core_threads(6) - .threaded_scheduler() + let rt = tokio::runtime::Builder::new_multi_thread() + .worker_threads(6) .build() .unwrap(); @@ -51,8 +49,8 @@ fn uncontended_concurrent_multi(b: &mut Bencher) { } fn uncontended_concurrent_single(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .basic_scheduler() + let rt = tokio::runtime::Builder::new_multi_thread() + .worker_threads(0) .build() .unwrap(); @@ -73,9 +71,8 @@ fn uncontended_concurrent_single(b: &mut Bencher) { } fn contended_concurrent_multi(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .core_threads(6) - .threaded_scheduler() + let rt = tokio::runtime::Builder::new_multi_thread() + .worker_threads(6) .build() .unwrap(); @@ -97,8 +94,7 @@ fn contended_concurrent_multi(b: &mut Bencher) { } fn contended_concurrent_single(b: &mut Bencher) { - let rt = tokio::runtime::Builder::new() - .basic_scheduler() + let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); |