-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
While attempting to port this Rust snippet, which executes in ~3 seconds + some overhead irrespective of thread count
let mut tasklist = vec![];
for _ in 1..tasks {
let t = thread::spawn(|| thread::sleep(Duration::from_secs(3)));
tasklist.push(t)
}
for t in tasklist { t.join().unwrap() }
to domainslib as so
let tasklist =
Array.init tasks (fun _ -> async pool (fun _ -> Unix.sleep 10))
in
run pool (fun _ -> Array.iter (await pool) tasklist)
where tasks is user-supplied, I found that for n > num_domains + 1, the wait times start to change significantly.
e.g. at num_domains = 2, and tasks = 100, the execution time is ~33x what's expected.
I've searched the docs here for "the right way to go idle" in different wordings but found nothing on this. I'm not sure what's different with Unix.sleep
or domainslib's task implementation.
Metadata
Metadata
Assignees
Labels
No labels