sc/source/core/data/patattr.cxx |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit c8742f36fa2bdc9d23042378f5b587ccda8b54dd
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu May 22 10:18:48 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat May 24 22:00:42 2025 +0200

    tdf#166684 reduce cost of CellAttributeHelper::registerAndCheck
    
    we can avoid checking the style name repeatedly in the loop
    by using the sorted data structure to get an upper as well as a lower bound.
    
    Reduces load time by 80%.
    
    Change-Id: Id08ec2d77a5292bc8ab0eb7cd44672f6b5a69491
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185651
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 002017455999..2dfcf5383771 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -114,12 +114,10 @@ const ScPatternAttr* 
CellAttributeHelper::registerAndCheck(const ScPatternAttr&
         return mpLastHit;
     }
     const OUString* pCandidateStyleName = rCandidate.GetStyleName();
-    auto it = maRegisteredCellAttributes.lower_bound(pCandidateStyleName);
-    for (; it != maRegisteredCellAttributes.end(); ++it)
+    auto [it, itEnd] = 
maRegisteredCellAttributes.equal_range(pCandidateStyleName);
+    for (; it != itEnd; ++it)
     {
         const ScPatternAttr* pCheck = *it;
-        if (CompareStringPtr(pCheck->GetStyleName(), pCandidateStyleName) != 0)
-            break;
         if (ScPatternAttr::areSame(pCheck, &rCandidate))
         {
             pCheck->mnRefCount++;

Reply via email to