diff options
author | Noel Grandin <noelgrandin@collabora.co.uk> | 2022-11-02 16:04:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-11-02 18:46:40 +0100 |
commit | 69910b540ae5140123fd2d4d67a9d338f980db53 (patch) | |
tree | a8761cfe6a74fd4c5d9b924ff0b19c9f000b7408 /sc | |
parent | ac90933dde68c6daf1eeebabb55de6e361eb4995 (diff) |
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.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/colcontainer.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
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: */ |