diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2018-06-24 11:59:51 +0900 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-24 08:08:07 +0200 |
commit | b42c316fcf36f478c4d4685c5d2294e079310693 (patch) | |
tree | 17c7ddd57531a486aca5ce48e4b69b0f961859d8 /sd/source/ui/view | |
parent | 5211bc416e410ead0827912c12d666643e3eb11e (diff) |
sd: Reduce the number of possible intermediate allocations
... by reserving enough space at once.
As the length of these vectors depends/grows on user's input,
this change can be a micro optimization.
Change-Id: I1baa7d1433875491e86403d727f11f676d29a833
Reviewed-on: https://gerrit.libreoffice.org/56346
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/view')
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index be1c561a096a..93f3fcc85684 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -1168,7 +1168,7 @@ void ViewShell::ImpGetUndoStrings(SfxItemSet &rSet) const { // prepare list std::vector<OUString> aStringList; - + aStringList.reserve(nCount); for (sal_uInt16 a = 0; a < nCount; ++a) { // generate one String in list per undo step @@ -1195,9 +1195,8 @@ void ViewShell::ImpGetRedoStrings(SfxItemSet &rSet) const { // prepare list ::std::vector< OUString > aStringList; - sal_uInt16 a; - - for( a = 0; a < nCount; a++) + aStringList.reserve(nCount); + for(sal_uInt16 a = 0; a < nCount; a++) // generate one String in list per undo step aStringList.push_back( pUndoManager->GetRedoActionComment(a) ); |