From f261347e9a8a98bb0273bb75e084956c033e7e67 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 4 Oct 2024 11:55:32 +0200 Subject: [PATCH] client/barrier: use empty() instead of size()==0 For some containers, `empty()` is faster than `size()`. Signed-off-by: Max Kellermann --- src/client/barrier.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/barrier.cc b/src/client/barrier.cc index dfdedaf58565..ff365665d537 100644 --- a/src/client/barrier.cc +++ b/src/client/barrier.cc @@ -119,7 +119,7 @@ void BarrierContext::commit_barrier(barrier_interval &civ) std::unique_lock locker(lock); /* we commit outstanding writes--if none exist, we don't care */ - if (outstanding_writes.size() == 0) + if (outstanding_writes.empty()) return; boost::icl::interval_set cvs; @@ -174,7 +174,7 @@ void BarrierContext::complete(C_Block_Sync &cbs) /* signal waiters */ barrier->cond.notify_all(); /* dispose cleared barrier */ - if (barrier->write_list.size() == 0) { + if (barrier->write_list.empty()) { BarrierList::iterator iter2 = BarrierList::s_iterator_to(*barrier); active_commits.erase(iter2); -- 2.47.3