From patchwork Thu Jan 30 11:50:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22673 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id E3499BDB1C for ; Thu, 30 Jan 2025 11:51:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 94B7B6856B; Thu, 30 Jan 2025 12:51:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=protonmail.com header.i=@protonmail.com header.b="SIGfMAhp"; dkim-atps=neutral Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DEC8268564 for ; Thu, 30 Jan 2025 12:51:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1738237889; x=1738497089; bh=RlWobZ/H0WWwvgbFlZzkTlSBuNxPsg2LYAMadRltoag=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=SIGfMAhp+WbrDvAQusk6S7RG9HajOChuQd73AgG5Aj8nLgocCD9mxmhpDsbLsfvk9 XFheDnIHESzbpbLcIz0YgaX6kmqMGa2os+sOs2zmBjBeEPrRi00dspD5eU3P4UTWEj qDjGHbS/TlcMdEF6ifsigEfIWIICQlXDkz4k4lTZVLPplTRfRy6ikXXXtmum92JIz3 NOElYuAPYnNVYjShYecEWNuB9pT3Ti90JrCQFDnmd8TudjB/M3J38rrUCHuRr5gZDu J/RHZIGRlUitiOziqyE/0zEZDaFqYMnK7hDc7cQ/8k+Mn0oqbdWkMF2ttq52oyw0rn Nt3pde3TXQ9VA== Date: Thu, 30 Jan 2025 11:50:18 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Cc: Jacopo Mondi , Paul Elder Subject: [RFC PATCH v3 03/21] apps: common: event_loop: Use `std::deque` instead of `std::list` Message-ID: <20250130115001.1129305-4-pobrn@protonmail.com> In-Reply-To: <20250130115001.1129305-1-pobrn@protonmail.com> References: <20250130115001.1129305-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: a05cc21231e9c2e1e1f3639077a6c5610ed9f755 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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(-) diff --git a/src/apps/common/event_loop.h b/src/apps/common/event_loop.h index 4e8dd0a46..760075885 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_;