From 3914801f1eb0b34cd4fbb0773d8ebf5778771f5f Mon Sep 17 00:00:00 2001 From: Wildan M Date: Wed, 29 Apr 2026 22:54:20 +0700 Subject: [PATCH] Speed up vector removal --- src/context/timeout.rs | 2 +- src/sync/wait_condition.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/context/timeout.rs b/src/context/timeout.rs index 9bf5c99095..dbf5de8efc 100644 --- a/src/context/timeout.rs +++ b/src/context/timeout.rs @@ -68,7 +68,7 @@ pub fn trigger(token: &mut CleanLockToken) { }; if trigger { - registry.remove(i).unwrap() + registry.swap_remove_back(i).unwrap() } else { i += 1; continue; diff --git a/src/sync/wait_condition.rs b/src/sync/wait_condition.rs index d31c4e0744..e521c64189 100644 --- a/src/sync/wait_condition.rs +++ b/src/sync/wait_condition.rs @@ -111,7 +111,7 @@ impl WaitCondition { .iter() .position(|c| Weak::as_ptr(c) == Arc::as_ptr(¤t_context_ref)) { - contexts.remove(index); + contexts.swap_remove(index); waited = false; } }