sc/source/core/data/patattr.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit e36d6dfb7674af25624aa873964b98f84e012b29
Author:     Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de>
AuthorDate: Fri Dec 29 12:21:56 2023 +0100
Commit:     Armin Le Grand <armin.le.gr...@me.com>
CommitDate: Fri Dec 29 18:01:11 2023 +0100

    Avoid one more expensive ScPatternAttr compare
    
    Change-Id: I2dc3f81ea3e44a335eea2a85df30390236d53299
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161402
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <armin.le.gr...@me.com>

diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 6d16cd716c9d..e54cb7ee2646 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -96,7 +96,7 @@ const ScPatternAttr* 
CellAttributeHelper::registerAndCheck(const ScPatternAttr&
         return &rCandidate;
     }
 
-    if (nullptr != mpLastHit && ScPatternAttr::areSame(mpLastHit, &rCandidate))
+    if (ScPatternAttr::areSame(mpLastHit, &rCandidate))
     {
         // hit for single-entry cache, make use of it
         mpLastHit->mnRefCount++;
@@ -107,6 +107,10 @@ const ScPatternAttr* 
CellAttributeHelper::registerAndCheck(const ScPatternAttr&
 
     for (const ScPatternAttr* pCheck : maRegisteredCellAttributes)
     {
+        if (mpLastHit == pCheck)
+            // ptr compare: already checked above, skip this one
+            continue;
+
         if (ScPatternAttr::areSame(pCheck, &rCandidate))
         {
             pCheck->mnRefCount++;

Reply via email to