diff --git a/benches/overhead.rs b/benches/overhead.rs index b048948..c0c5c06 100644 --- a/benches/overhead.rs +++ b/benches/overhead.rs @@ -55,7 +55,7 @@ fn no_overhead(bencher: Bencher, nodes: (usize, usize)) { } #[divan::bench(args = nodes())] -fn overhead(bencher: Bencher, nodes: (usize, usize)) { +fn spice_overhead(bencher: Bencher, nodes: (usize, usize)) { fn sum(node: &Node, scope: &mut Scope<'_>) -> u64 { let (left, right) = scope.join( |s| node.left.as_deref().map(|n| sum(n, s)).unwrap_or_default(), diff --git a/src/job.rs b/src/job.rs index e8ce551..50184f8 100644 --- a/src/job.rs +++ b/src/job.rs @@ -1,6 +1,5 @@ use std::{ cell::{Cell, UnsafeCell}, - hint, mem::ManuallyDrop, panic::{self, AssertUnwindSafe}, ptr::{self, NonNull}, @@ -63,9 +62,7 @@ impl Future { _ => (), } - // Spinning time should be short since the lock is held only to - // write the `Box` and unpark this thread. - hint::spin_loop(); + thread::yield_now(); } } @@ -82,9 +79,7 @@ impl Future { match result { Ok(_) => break, - // Spinning time should be short since the lock is held only to - // write the thread to `self.waiting_thread`. - Err(_) => hint::spin_loop(), + Err(_) => thread::yield_now(), } }