diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-31 10:57:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-31 18:21:56 +0200 |
commit | dbc655a1e6bdb118e09d87d1fd9022c201d7b068 (patch) | |
tree | 8eba9ddad365c8514e9de1845bd63586f72cc6f2 /extensions | |
parent | 2b0b12fa3bf9a880ad447368f7bd8a296e3a2834 (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/propctrlr/propcontroller.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
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<size_t>(aProperties.size() + aThisHandlersProperties.size(), aProperties.size() * 2) ); for (const auto & aThisHandlersProperty : aThisHandlersProperties) { auto noPrevious = std::none_of( |