sd/source/ui/animations/CustomAnimationPane.cxx | 4 ++-- sd/source/ui/view/viewshel.cxx | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-)
New commits: commit b42c316fcf36f478c4d4685c5d2294e079310693 Author: Takeshi Abe <t...@fixedpoint.jp> Date: Sun Jun 24 11:59:51 2018 +0900 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.gran...@collabora.co.uk> diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 44987fcaa791..2421d51ec461 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -1778,8 +1778,8 @@ void CustomAnimationPane::onAdd() maViewSelection >>= xShapes; sal_Int32 nCount = xShapes->getCount(); - sal_Int32 nIndex; - for( nIndex = 0; nIndex < nCount; nIndex++ ) + aTargets.reserve( nCount ); + for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) { Any aTarget( xShapes->getByIndex( nIndex ) ); aTargets.push_back( aTarget ); 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) ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits