From patchwork Tue Jan 14 18:22:01 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: 22564 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 BD6C8C3301 for ; Tue, 14 Jan 2025 18:22:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7800D6854A; Tue, 14 Jan 2025 19:22:07 +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="uzbjIayn"; dkim-atps=neutral Received: from mail-40133.protonmail.ch (mail-40133.protonmail.ch [185.70.40.133]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CE787607D6 for ; Tue, 14 Jan 2025 19:22:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1736878926; x=1737138126; bh=O1CQWalgQFzFWQZzwARSpGSVXVcoPm81HjvhNzkX9yg=; h=Date:To:From: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=uzbjIaynEQ923pr9PPXrhCth60agpkHPivNQISkfMScnHo67mMr9f3tiRQTb/ymVH f8zambcxBZV+D/5+kJ9wt/VVbmV0A6fhzMyOZOih4GUY2JXvtneQz5oAogMG8WAaxn 2ZhN0S3CRxM3qdKo4ugD9t9tsPafH7qeO/DruGPMmhAQ1TlahYa9rOWoRmNhA245T9 mjigiUZOIGQTAr1FpTGcMQrLOIqPq7dmNTUrk6ypVYacnMcKHe9XvBIWUTxFF3fKsR I6/b6pho9M/3qfC/XxsVQ7tyGvRivk7TNqPIQBAZ/Ps0QHRMR9nAu1iSj0CuC99Y54 kTiOFFatgNgug== Date: Tue, 14 Jan 2025 18:22:01 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [RFC PATCH v2 03/16] apps: common: event_loop: Use `std::deque` instead of `std::list` Message-ID: <20250114182143.1773762-4-pobrn@protonmail.com> In-Reply-To: <20250114182143.1773762-1-pobrn@protonmail.com> References: <20250114182143.1773762-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: b67cac3cb6bbdbf9e36f2555012229351243e0bc 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 --- 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_;