summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-12-07 19:07:37 +0100
committerEike Rathke <erack@redhat.com>2016-12-07 21:17:48 +0100
commit7fc84a8e6678e3d0399983f5a078c9b2beb6ee4b (patch)
treef404ff7aceff2e1b8289c66dcf15e3b813fd1b1b
parent68c2c8659d8c5d067d0be0b9795d4ddaeb312e2e (diff)
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
-rw-r--r--sc/source/filter/excel/xetable.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index d22eb46a9e57..37470f52bad0 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
+ }
}
}
}