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.
While attempting to port this Rust snippet, which executes in ~3 seconds + some overhead irrespective of thread count
to domainslib as so
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.sleepor domainslib's task implementation.