From 801b8191ef14d6f7f9c63f9c41ac78ed360583c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Thu, 3 Jan 2019 14:11:07 +0100 Subject: [PATCH] Use LenCachingMutex to optimize verification. (#10117) --- ethcore/src/verification/queue/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ethcore/src/verification/queue/mod.rs b/ethcore/src/verification/queue/mod.rs index b1ab7a130..f7de3eaa1 100644 --- a/ethcore/src/verification/queue/mod.rs +++ b/ethcore/src/verification/queue/mod.rs @@ -585,10 +585,12 @@ impl VerificationQueue { } /// Returns true if there is nothing currently in the queue. - /// TODO [ToDr] Optimize to avoid locking pub fn is_empty(&self) -> bool { let v = &self.verification; - v.unverified.lock().is_empty() && v.verifying.lock().is_empty() && v.verified.lock().is_empty() + + v.unverified.load_len() == 0 + && v.verifying.load_len() == 0 + && v.verified.load_len() == 0 } /// Get queue status.