From dbc655a1e6bdb118e09d87d1fd9022c201d7b068 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 31 Aug 2022 10:57:39 +0200 Subject: cid#1509230 Inefficient vector resizing with reserve. preserve the benefits of reserving with the benefits of logarithmic doubling Change-Id: I41896d1cef3e9939fda13f055e045ccb5d6ea1ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139085 Tested-by: Jenkins Reviewed-by: Noel Grandin --- extensions/source/propctrlr/propcontroller.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 624bf03d16b6..b0516fd90903 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -956,7 +956,7 @@ namespace pcr } // append these properties to our "all properties" array - aProperties.reserve( aProperties.size() + aThisHandlersProperties.size() ); + aProperties.reserve( std::max(aProperties.size() + aThisHandlersProperties.size(), aProperties.size() * 2) ); for (const auto & aThisHandlersProperty : aThisHandlersProperties) { auto noPrevious = std::none_of( -- cgit