From 54055dd0c21caac78fae4d983857cd67a587fa73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Tue, 14 Jan 2025 16:38:56 +0100 Subject: apps: common: event_loop: Use `std::deque` instead of `std::list` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deque has fast pop_front and push_back operations while making fewer allocations for the same number of elements as an `std::list`. So use an `std::deque` for storing the deferred calls of the loop. Signed-off-by: Barnabás Pőcze Reviewed-by: Jacopo Mondi Reviewed-by: Paul Elder --- src/apps/common/event_loop.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/apps') diff --git a/src/apps/common/event_loop.h b/src/apps/common/event_loop.h index 4e8dd0a4..76007588 100644 --- a/src/apps/common/event_loop.h +++ b/src/apps/common/event_loop.h @@ -8,6 +8,7 @@ #pragma once #include +#include #include #include #include @@ -63,7 +64,8 @@ private: struct event_base *base_; int exitCode_; - std::list> calls_; + std::deque> calls_; + std::list> events_; std::mutex lock_; -- cgit v1.2.1