sc/source/core/data/colcontainer.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 69910b540ae5140123fd2d4d67a9d338f980db53
Author:     Noel Grandin <noelgran...@collabora.co.uk>
AuthorDate: Wed Nov 2 16:04:52 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Nov 2 18:46:40 2022 +0100

    tdf#54857 improve resizing of columns
    
    repeated calls to resize() means we bypass the normal doubling behaviour
    of the vector, so rather let it do it's own thing.
    
    Change-Id: I7b4273d20b6cdcac6aeddd61395fbe64de004c9f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142176
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/source/core/data/colcontainer.cxx 
b/sc/source/core/data/colcontainer.cxx
index a0a9d845772f..f6ef8ff7da17 100644
--- a/sc/source/core/data/colcontainer.cxx
+++ b/sc/source/core/data/colcontainer.cxx
@@ -47,9 +47,10 @@ void ScColContainer::Clear()
 void ScColContainer::resize( ScSheetLimits const & rSheetLimits, const size_t 
aNewColSize )
 {
     size_t aOldColSize = aCols.size();
-    aCols.resize( aNewColSize );
+    if (aNewColSize > aCols.capacity())
+        aCols.reserve( aNewColSize );
     for ( size_t nCol = aOldColSize; nCol < aNewColSize; ++nCol )
-        aCols[nCol].reset(new ScColumn(rSheetLimits));
+        aCols.emplace_back(new ScColumn(rSheetLimits));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to