[{"id":34241,"web_url":"https://patchwork.libcamera.org/comment/34241/","msgid":"<174731250695.209691.5770821078179549049@calcite>","date":"2025-05-15T12:35:06","subject":"Re: [RFC PATCH v1 6/8] libcamera: ipa_data_serializer: Remove some\n\tvector `reserve()` calls","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Quoting Barnabás Pőcze (2025-05-15 14:00:10)\n> `appendPOD()` does a single insertion, so if only a single `appendPOD()`\n> will be called on a vector before returning, then calling `reserve()`\n> is not that useful, so remove it.\n> \n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  include/libcamera/internal/ipa_data_serializer.h | 1 -\n>  src/libcamera/ipa_data_serializer.cpp            | 1 -\n>  2 files changed, 2 deletions(-)\n> \n> diff --git a/include/libcamera/internal/ipa_data_serializer.h b/include/libcamera/internal/ipa_data_serializer.h\n> index b4614f21d..b1fefba58 100644\n> --- a/include/libcamera/internal/ipa_data_serializer.h\n> +++ b/include/libcamera/internal/ipa_data_serializer.h\n> @@ -309,7 +309,6 @@ public:\n>         serialize(const Flags<E> &data, [[maybe_unused]] ControlSerializer *cs = nullptr)\n>         {\n>                 std::vector<uint8_t> dataVec;\n> -               dataVec.reserve(sizeof(Flags<E>));\n>                 appendPOD<uint32_t>(dataVec, static_cast<typename Flags<E>::Type>(data));\n>  \n>                 return { dataVec, {} };\n> diff --git a/src/libcamera/ipa_data_serializer.cpp b/src/libcamera/ipa_data_serializer.cpp\n> index 2189a2466..0537f785b 100644\n> --- a/src/libcamera/ipa_data_serializer.cpp\n> +++ b/src/libcamera/ipa_data_serializer.cpp\n> @@ -196,7 +196,6 @@ IPADataSerializer<type>::serialize(const type &data,                        \\\n>                                   [[maybe_unused]] ControlSerializer *cs) \\\n>  {                                                                      \\\n>         std::vector<uint8_t> dataVec;                                   \\\n> -       dataVec.reserve(sizeof(type));                                  \\\n>         appendPOD<type>(dataVec, data);                                 \\\n>                                                                         \\\n>         return { dataVec, {} };                                         \\\n> -- \n> 2.49.0\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 1BED1C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 15 May 2025 12:35:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B3B4E68D6A;\n\tThu, 15 May 2025 14:35:12 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3E56568B6C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 May 2025 14:35:11 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2a01:cb16:204c:4644:2597:989f:e013:9296])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E63D1836;\n\tThu, 15 May 2025 14:34:53 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"egrUHPMr\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1747312494;\n\tbh=DzoAqEhPn/MS4YmhnXn+IPi01mtlWRUZiRHr26RgkcI=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=egrUHPMrUEQv9IKW9cy78SfoU3FeLlXCuZM6WE7ff9Pant9bamhH8yxA0hSn93vEn\n\tz4G2Jvoa3UPwyKO4+prE+TxArbXnDkpqwojfmIRRVUUBLs16ECN4TTOxaCmz5DHQuN\n\ttqoMdkoTjxaTnaeZ8K489v5PnJaqKOY5U42/fn4c=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250515120012.3127231-7-barnabas.pocze@ideasonboard.com>","References":"<20250515120012.3127231-1-barnabas.pocze@ideasonboard.com>\n\t<20250515120012.3127231-7-barnabas.pocze@ideasonboard.com>","Subject":"Re: [RFC PATCH v1 6/8] libcamera: ipa_data_serializer: Remove some\n\tvector `reserve()` calls","From":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 15 May 2025 14:35:06 +0200","Message-ID":"<174731250695.209691.5770821078179549049@calcite>","User-Agent":"alot/0.10","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34294,"web_url":"https://patchwork.libcamera.org/comment/34294/","msgid":"<t2pcmpfjspghqcm6kmcbfcf6ctkewpewqoraxd5rgmat6ocedx@egaopgguvyub>","date":"2025-05-20T11:50:24","subject":"Re: [RFC PATCH v1 6/8] libcamera: ipa_data_serializer: Remove some\n\tvector `reserve()` calls","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Barnabás\n\nOn Thu, May 15, 2025 at 02:00:10PM +0200, Barnabás Pőcze wrote:\n> `appendPOD()` does a single insertion, so if only a single `appendPOD()`\n> will be called on a vector before returning, then calling `reserve()`\n> is not that useful, so remove it.\n>\n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nThanks\n  j\n\n> ---\n>  include/libcamera/internal/ipa_data_serializer.h | 1 -\n>  src/libcamera/ipa_data_serializer.cpp            | 1 -\n>  2 files changed, 2 deletions(-)\n>\n> diff --git a/include/libcamera/internal/ipa_data_serializer.h b/include/libcamera/internal/ipa_data_serializer.h\n> index b4614f21d..b1fefba58 100644\n> --- a/include/libcamera/internal/ipa_data_serializer.h\n> +++ b/include/libcamera/internal/ipa_data_serializer.h\n> @@ -309,7 +309,6 @@ public:\n>  \tserialize(const Flags<E> &data, [[maybe_unused]] ControlSerializer *cs = nullptr)\n>  \t{\n>  \t\tstd::vector<uint8_t> dataVec;\n> -\t\tdataVec.reserve(sizeof(Flags<E>));\n>  \t\tappendPOD<uint32_t>(dataVec, static_cast<typename Flags<E>::Type>(data));\n>\n>  \t\treturn { dataVec, {} };\n> diff --git a/src/libcamera/ipa_data_serializer.cpp b/src/libcamera/ipa_data_serializer.cpp\n> index 2189a2466..0537f785b 100644\n> --- a/src/libcamera/ipa_data_serializer.cpp\n> +++ b/src/libcamera/ipa_data_serializer.cpp\n> @@ -196,7 +196,6 @@ IPADataSerializer<type>::serialize(const type &data,\t\t\t\\\n>  \t\t\t\t  [[maybe_unused]] ControlSerializer *cs) \\\n>  {\t\t\t\t\t\t\t\t\t\\\n>  \tstd::vector<uint8_t> dataVec;\t\t\t\t\t\\\n> -\tdataVec.reserve(sizeof(type));\t\t\t\t\t\\\n>  \tappendPOD<type>(dataVec, data);\t\t\t\t\t\\\n>  \t\t\t\t\t\t\t\t\t\\\n>  \treturn { dataVec, {} };\t\t\t\t\t\t\\\n> --\n> 2.49.0\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5D55AC31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 May 2025 11:50:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1031668D85;\n\tTue, 20 May 2025 13:50:29 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9DB6A614DE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 May 2025 13:50:27 +0200 (CEST)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0C5A574C;\n\tTue, 20 May 2025 13:50:07 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"oCgztvpE\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1747741807;\n\tbh=CdiGHoU/9MZ4g+IsKlhl62fUZTEpAeZoTWVaXASkuiQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=oCgztvpEp7QGTL8xvmlnKgCHRCbOLPJzp3y8AIJjWKBL4hDGiTV3JHh12qay3YwZP\n\tBijbHfs3FNYJQMdCVhxnJ9dWtmIfL6E6gxVtLpU+4uIsPIYA6jc+YMt1EfmncxXv6T\n\tM6Ivu1dIPihsVaYdp9lhqNW1TYc+7EgY0zC3yKrg=","Date":"Tue, 20 May 2025 13:50:24 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, \n\tPaul Elder <paul.elder@ideasonboard.com>","Subject":"Re: [RFC PATCH v1 6/8] libcamera: ipa_data_serializer: Remove some\n\tvector `reserve()` calls","Message-ID":"<t2pcmpfjspghqcm6kmcbfcf6ctkewpewqoraxd5rgmat6ocedx@egaopgguvyub>","References":"<20250515120012.3127231-1-barnabas.pocze@ideasonboard.com>\n\t<20250515120012.3127231-7-barnabas.pocze@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20250515120012.3127231-7-barnabas.pocze@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]