Skip to content

Commit 515de86

Browse files
Rewrite Rust benchmarks (#5)
1 parent ff4860f commit 515de86

File tree

9 files changed

+362
-199
lines changed

9 files changed

+362
-199
lines changed

rust_async_std/Cargo.lock

Lines changed: 1 addition & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust_async_std/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ edition = "2021"
55

66
[dependencies]
77
async-std = { version = "1.13.0", features = ["attributes"] }
8-
futures = "0.3.31"

rust_async_std/src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
use std::env;
22
use async_std::task;
3-
use futures::future::join_all;
43
use std::time::Duration;
54

65
#[async_std::main]
76
async fn main() {
87
let args: Vec<String> = env::args().collect();
98
let num_tasks = args[1].parse::<usize>().unwrap();
10-
9+
1110
let mut tasks = Vec::new();
1211
for _ in 0..num_tasks {
13-
tasks.push(task::sleep(Duration::from_secs(10)));
12+
tasks.push(task::spawn(task::sleep(Duration::from_secs(10))));
1413
}
1514

16-
join_all(tasks).await;
15+
for task in tasks {
16+
task.await;
17+
}
1718
}

0 commit comments

Comments
 (0)