[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Wed Dec 7 20:18:20 UTC 2016


 sc/source/filter/excel/xetable.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 7fc84a8e6678e3d0399983f5a078c9b2beb6ee4b
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Dec 7 19:07:37 2016 +0100

    sc-perf: possibly halve the iterations to find the most used XF index
    
    Iterate only 513 equally attributed cells instead of 1024, per row.
    This could be further enhanced if we remembered in advance in which
    column the last attribution is located and use empty/default for the
    rest, or use spans.
    
    Change-Id: Id6172bd6c350a92fda4f1b637e70ff4f19d59c5a

diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index d22eb46..37470f5 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -1960,6 +1960,7 @@ void XclExpRow::Finalize( const ScfUInt16Vec& rColXFIndexes, bool bProgress )
     XclExpXFIndexMap aIndexMap;
     sal_uInt16 nRowXFIndex = EXC_XF_DEFAULTCELL;
     size_t nMaxXFCount = 0;
+    const size_t nHalfIndexes = aXFIndexes.size() / 2;
     for( aCellIt = aCellBeg; aCellIt != aCellEnd; ++aCellIt )
     {
         if( *aCellIt != EXC_XF_NOTFOUND )
@@ -1970,6 +1971,14 @@ void XclExpRow::Finalize( const ScfUInt16Vec& rColXFIndexes, bool bProgress )
             {
                 nRowXFIndex = *aCellIt;
                 nMaxXFCount = rnCount;
+                if (nMaxXFCount > nHalfIndexes)
+                {
+                    // No other XF index can have a greater usage count, we
+                    // don't need to loop through the remaining cells.
+                    // Specifically for the tail of unused default
+                    // cells/columns this makes a difference.
+                    break;  // for
+                }
             }
         }
     }


More information about the Libreoffice-commits mailing list