Comment Comment by vbsd Huh, you're right about this, thanks.On the other hand, I maintain that this is an incidental rather than essential reason for the program finishing quickly. In that benchmark code, we can replace "sleep" with our custom sleep function which does not record start time before execution: async fn wrapped_sleep(d: Duration) { sleep(d).await } The following program will still finish in ~10 seconds. #[tokio::main] async fn main() { let num_tasks = 100; let mut tasks = Vec::new(); for _ in 0..num_tasks { tasks.push(wrapped_sleep(Duration::from_secs(10))); } futures::future::join_all(tasks).await; } parent vbsd 1 year ago
On the other hand, I maintain that this is an incidental rather than essential reason for the program finishing quickly. In that benchmark code, we can replace "sleep" with our custom sleep function which does not record start time before execution:
The following program will still finish in ~10 seconds.