Kaydet (Commit) b42c316f authored tarafından Takeshi Abe's avatar Takeshi Abe Kaydeden (comit) Noel Grandin

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: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 5211bc41
......@@ -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 );
......
......@@ -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) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment