From bf5e5f9b127e1420b7de31d3c61091494706d881 Mon Sep 17 00:00:00 2001 From: Noah Kennedy Date: Fri, 4 Oct 2024 10:49:50 -0500 Subject: [PATCH] send big futures to the heap in release mode --- tokio/src/runtime/local_runtime/runtime.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tokio/src/runtime/local_runtime/runtime.rs b/tokio/src/runtime/local_runtime/runtime.rs index ab9d1c1a121..eb5b39cddde 100644 --- a/tokio/src/runtime/local_runtime/runtime.rs +++ b/tokio/src/runtime/local_runtime/runtime.rs @@ -149,7 +149,7 @@ impl LocalRuntime { { // safety: spawn_local can only be called from `LocalRuntime`, which this is unsafe { - if cfg!(debug_assertions) && std::mem::size_of::() > BOX_FUTURE_THRESHOLD { + if std::mem::size_of::() > BOX_FUTURE_THRESHOLD { self.handle.spawn_local_named(Box::pin(future), None) } else { self.handle.spawn_local_named(future, None) @@ -211,7 +211,7 @@ impl LocalRuntime { /// ``` #[track_caller] pub fn block_on(&self, future: F) -> F::Output { - if cfg!(debug_assertions) && std::mem::size_of::() > BOX_FUTURE_THRESHOLD { + if std::mem::size_of::() > BOX_FUTURE_THRESHOLD { self.block_on_inner(Box::pin(future)) } else { self.block_on_inner(future)