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

New commits:
commit 45ab0294311711f5072585ef85030c538d773b08
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu May 22 10:18:48 2025 +0200
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Sun Jun 15 22:52:17 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 <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit c8742f36fa2bdc9d23042378f5b587ccda8b54dd)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185740
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Tomaž Vajngerl <[email protected]>

diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 60225c17532a..67498a98cc4a 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