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/mpsc.rs | |
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/mpsc.rs')
-rw-r--r-- | benches/mpsc.rs | 37 |
1 files changed, 12 insertions, 25 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 { |