svx/source/svdraw/svdobj.cxx                            |   26 +++++++++-------
 sw/source/core/doc/DocumentContentOperationsManager.cxx |    1 
 2 files changed, 16 insertions(+), 11 deletions(-)

New commits:
commit 21acea9227b407434c561628760973c61f4c60fa
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue Feb 10 15:26:29 2026 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Feb 26 16:58:46 2026 +0100

    tdf#170595 we can reduce re-alloc a little here
    
    by sizing the vector up front
    
    Change-Id: I69db8759c329525e25b05d13abd6c041b4b44965
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199268
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    (cherry picked from commit 198819764694608d0c5e519c2b87ed64ae906bca)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200415
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 0472afa6e1eb..1e8eaae913ca 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4095,6 +4095,7 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl(
     // They are stored as matching the originals, so that we will be later
     // able to build the chains accordingly.
     std::vector< SwFrameFormat* > aVecSwFrameFormat;
+    aVecSwFrameFormat.reserve(aSet.size());
     std::set< ZSortFly >::const_iterator it=aSet.begin();
 
     while (it != aSet.end())
commit bffa044b55231e5a554152b0e2131be34962510b
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue Feb 10 13:27:36 2026 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Feb 26 16:58:36 2026 +0100

    tdf#170595 speed up SdrObject::MakeNameUnique a little
    
    we only need to check for strings with a similar baseline,
    which reduces time spent inserting into the hashset and
    probing the hashset
    
    Change-Id: I09e74fb4818f7decaf72c5cdc825de4b4b4fa0d8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199267
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>
    (cherry picked from commit a05b8078278212af227dd0c0046d4ad9f231eb04)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200414
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 947d00a855b7..d97dd1407eee 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -3205,6 +3205,16 @@ void 
SdrObject::MakeNameUnique(std::unordered_set<OUString>& rNameSet)
     if (GetName().isEmpty())
         return;
 
+    OUString sName(GetName().trim());
+    OUString sRootName(sName);
+
+    if (!sName.isEmpty() && rtl::isAsciiDigit(sName[sName.getLength() - 1]))
+    {
+        sal_Int32 nPos(sName.getLength() - 1);
+        while (nPos > 0 && rtl::isAsciiDigit(sName[--nPos]));
+        sRootName = o3tl::trim(sName.subView(0, nPos + 1));
+    }
+
     if (rNameSet.empty())
     {
         SdrPage* pPage;
@@ -3217,21 +3227,15 @@ void 
SdrObject::MakeNameUnique(std::unordered_set<OUString>& rNameSet)
             {
                 pObj = aIter.Next();
                 if (pObj != this)
-                    rNameSet.insert(pObj->GetName());
+                {
+                    auto rName = pObj->GetName();
+                    if (rName.startsWith(sRootName))
+                        rNameSet.insert(rName);
+                }
             }
         }
     }
 
-    OUString sName(GetName().trim());
-    OUString sRootName(sName);
-
-    if (!sName.isEmpty() && rtl::isAsciiDigit(sName[sName.getLength() - 1]))
-    {
-        sal_Int32 nPos(sName.getLength() - 1);
-        while (nPos > 0 && rtl::isAsciiDigit(sName[--nPos]));
-        sRootName = o3tl::trim(sName.subView(0, nPos + 1));
-    }
-
     for (sal_uInt32 n = 1; rNameSet.find(sName) != rNameSet.end(); n++)
         sName = sRootName + " " + OUString::number(n);
     rNameSet.insert(sName);

Reply via email to