summaryrefslogtreecommitdiffstats
path: root/benches/spawn.rs
diff options
context:
space:
mode:
authorLucio Franco <luciofranco14@gmail.com>2020-08-27 20:05:48 -0400
committerGitHub <noreply@github.com>2020-08-27 20:05:48 -0400
commitd600ab9a8f37e9eff3fa8587069a816b65b6da0b (patch)
tree06d14901604c5c7822b43d9f4973fdccd15509e7 /benches/spawn.rs
parentd9d909cb4c6d326423ee02fbcf6bbfe5553d2c0a (diff)
rt: Refactor `Runtime::block_on` to take `&self` (#2782)
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
Diffstat (limited to 'benches/spawn.rs')
-rw-r--r--benches/spawn.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/benches/spawn.rs b/benches/spawn.rs
index 9122c7b1..f76daf3f 100644
--- a/benches/spawn.rs
+++ b/benches/spawn.rs
@@ -10,7 +10,7 @@ async fn work() -> usize {
}
fn basic_scheduler_local_spawn(bench: &mut Bencher) {
- let mut runtime = tokio::runtime::Builder::new()
+ let runtime = tokio::runtime::Builder::new()
.basic_scheduler()
.build()
.unwrap();
@@ -23,7 +23,7 @@ fn basic_scheduler_local_spawn(bench: &mut Bencher) {
}
fn threaded_scheduler_local_spawn(bench: &mut Bencher) {
- let mut runtime = tokio::runtime::Builder::new()
+ let runtime = tokio::runtime::Builder::new()
.threaded_scheduler()
.build()
.unwrap();
@@ -40,9 +40,9 @@ fn basic_scheduler_remote_spawn(bench: &mut Bencher) {
.basic_scheduler()
.build()
.unwrap();
- let handle = runtime.handle();
+
bench.iter(|| {
- let h = handle.spawn(work());
+ let h = runtime.spawn(work());
black_box(h);
});
}
@@ -52,9 +52,9 @@ fn threaded_scheduler_remote_spawn(bench: &mut Bencher) {
.threaded_scheduler()
.build()
.unwrap();
- let handle = runtime.handle();
+
bench.iter(|| {
- let h = handle.spawn(work());
+ let h = runtime.spawn(work());
black_box(h);
});
}