[ooo-build-commit] patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Thu Jun 18 14:09:20 PDT 2009


 patches/dev300/apply                                    |    7 +
 patches/dev300/calc-perf-copy-table-flags.diff          |   75 ++++++++++++++++
 patches/dev300/calc-perf-rowheight-no-progress-bar.diff |   28 +++++
 3 files changed, 110 insertions(+)

New commits:
commit 158c254ff905f04f1195686e5565020c3c2d5397
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Jun 18 17:02:42 2009 -0400

    More performance optimazation associated with row limit increase.
    
    1) Better algorithm to copy hidden row flags, to make use of segment
    info, and 2) don't draw progress bars during row height adjustment if
    the total row count is less than 1000.  For such small row size, it
    finishes instantly anyway; no point slowing it down by unnecessarily
    drawing progress bars. (n#514156)
    
    * patches/dev300/apply:
    * patches/dev300/calc-perf-copy-table-flags.diff:
    * patches/dev300/calc-perf-rowheight-no-progress-bar.diff:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 1449dfc..3776545 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3152,6 +3152,13 @@ calc-perf-sort.diff, n#504827, kohei
 # Speed up selection of large area, cursor placement in split view.
 calc-perf-lazy-overlay-objects.diff, n#511006, kohei
 
+# Better algorithm for row flag copying.
+calc-perf-copy-table-flags.diff, n#514156, kohei
+
+# don't show progress bar during row height adjustment if the row count is 
+# less than 1000.
+calc-perf-rowheight-no-progress-bar.diff, n#514156, kohei
+
 [ OOXMLExport ]
 oox-calc-export-row-limit.diff, n#504623, janneke.
 
diff --git a/patches/dev300/calc-perf-copy-table-flags.diff b/patches/dev300/calc-perf-copy-table-flags.diff
new file mode 100644
index 0000000..eaa8838
--- /dev/null
+++ b/patches/dev300/calc-perf-copy-table-flags.diff
@@ -0,0 +1,75 @@
+diff --git sc/source/core/data/table2.cxx sc/source/core/data/table2.cxx
+index 7907caa..c719e4f 100644
+--- sc/source/core/data/table2.cxx
++++ sc/source/core/data/table2.cxx
+@@ -644,6 +644,7 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
+             //	Charts muessen beim Ein-/Ausblenden angepasst werden
+             ScChartListenerCollection* pCharts = pDestTab->pDocument->GetChartListenerCollection();
+ 
++            bool bFlagChange = false;
+             if (nRow1==0 && nRow2==MAXROW && pColWidth && pDestTab->pColWidth)
+                 for (SCCOL i=nCol1; i<=nCol2; i++)
+                 {
+@@ -658,35 +659,46 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
+                         pCharts->SetRangeDirty(ScRange( i, 0, nTab, i, MAXROW, nTab ));
+ 
+                     if (bChange)
+-                        pDestTab->InvalidatePageBreaks();
++                        bFlagChange = true;
+                 }
+ 
+             if (nCol1==0 && nCol2==MAXCOL && pRowHeight && pDestTab->pRowHeight)
+             {
+                 bool bChange = pDestTab->pRowHeight->SumValues(nRow1, nRow2) != pRowHeight->SumValues(nRow1, nRow2);
+-
+                 if (bChange)
+-                    pDestTab->InvalidatePageBreaks();
++                    bFlagChange = true;
+ 
+                 pDestTab->pRowHeight->CopyFrom( *pRowHeight, nRow1, nRow2);
+-                for (SCROW i=nRow1; i<=nRow2; i++)
++                pDestTab->pRowFlags->CopyFrom(*pRowFlags, nRow1, nRow2);
++
++                for (SCROW i = nRow1; i <= nRow2; ++i)
+                 {
+-                    // TODO: might need some performance improvement, block
+-                    // operations instead of single GetValue()/SetValue() calls.
+-                    BYTE nThisRowFlags = pRowFlags->GetValue(i);
+-                    bool bThisHidden = RowHidden(i);
+-                    bool bHiddenChange = (pDestTab->RowHidden(i) != bThisHidden);
+-                    pDestTab->pRowFlags->SetValue( i, nThisRowFlags );
+-                    pDestTab->SetRowHidden(i, i, bThisHidden);
+-                    //!	Aenderungen zusammenfassen?
+-					if (bHiddenChange && pCharts)
+-                        pCharts->SetRangeDirty(ScRange( 0, i, nTab, MAXCOL, i, nTab ));
++                    SCROW nThisLastRow, nDestLastRow;
++                    bool bThisHidden = RowHidden(i, nThisLastRow);
++                    bool bDestHidden = pDestTab->RowHidden(i, nDestLastRow);
++
++                    // If the segment sizes differ, we take the shorter segment of the two.
++                    SCROW nLastRow = ::std::min(nThisLastRow, nDestLastRow);
++                    pDestTab->SetRowHidden(i, nLastRow, bThisHidden);
+ 
+-                    if (bHiddenChange)
+-                        pDestTab->InvalidatePageBreaks();
++                    bool bThisHiddenChange = (bThisHidden != bDestHidden);
++                    if (bThisHiddenChange && pCharts)
++                    {
++                        // Hidden flags differ.
++                        pCharts->SetRangeDirty(ScRange(0, i, nTab, MAXCOL, nLastRow, nTab));
++                    }
++
++                    if (bThisHiddenChange)
++                        bFlagChange = true;
++
++                    // Jump to the last row of the identical flag segment.
++                    i = nLastRow;
+                 }
+             }
+ 
++            if (bFlagChange)
++                pDestTab->InvalidatePageBreaks();
++
+             pDestTab->SetOutlineTable( pOutlineTable );		// auch nur wenn bColRowFlags
+         }
+     }
diff --git a/patches/dev300/calc-perf-rowheight-no-progress-bar.diff b/patches/dev300/calc-perf-rowheight-no-progress-bar.diff
new file mode 100644
index 0000000..c18bef1
--- /dev/null
+++ b/patches/dev300/calc-perf-rowheight-no-progress-bar.diff
@@ -0,0 +1,28 @@
+diff --git sc/source/core/data/table1.cxx sc/source/core/data/table1.cxx
+index 288378b..c2ce616 100644
+--- sc/source/core/data/table1.cxx
++++ sc/source/core/data/table1.cxx
+@@ -324,12 +324,22 @@ BOOL ScTable::SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, USHORT nExtra,
+     BOOL    bChanged = FALSE;
+     SCSIZE  nCount = static_cast<SCSIZE>(nEndRow-nStartRow+1);
+ 
++    ULONG nTotalCount = GetWeightedCount();
+     ScProgress* pProgress = NULL;
+     if ( pOuterProgress )
+         pProgress = pOuterProgress;
+     else if ( nCount > 1 )
+         pProgress = new ScProgress( pDocument->GetDocumentShell(),
+-                            ScGlobal::GetRscString(STR_PROGRESS_HEIGHTING), GetWeightedCount() );
++                            ScGlobal::GetRscString(STR_PROGRESS_HEIGHTING), nTotalCount );
++
++    if (nTotalCount < 1000)
++    {
++        // if the total number of rows is less than 1000, don't even bother 
++        // with the progress bar because drawing progress bar is very
++        // expensive.
++        delete pProgress;
++        pProgress = NULL;
++    }
+ 
+     USHORT* pHeight = new USHORT[nCount];                   // Twips !
+     memset( pHeight, 0, sizeof(USHORT) * nCount );


More information about the ooo-build-commit mailing list