[ooo-build-commit] patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Nov 13 13:45:27 PST 2009


 patches/dev300/apply                                              |    2 
 patches/dev300/calc-perf-page-and-manual-breaks-fwd-iterator.diff |   86 ++++++++++
 2 files changed, 88 insertions(+)

New commits:
commit 860c2a6433ed1ad0823d91da8318ae5e957299b7
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri Nov 13 16:30:51 2009 -0500

    Speed up row's hidden state lookup during pagenation.
    
    * patches/dev300/apply:
    * patches/dev300/calc-perf-page-and-manual-breaks-fwd-iterator.diff:
      speed up row's hidden state lookup when updating page breaks, which
      results in 40% performance improvement during printing. (n#554955)

diff --git a/patches/dev300/apply b/patches/dev300/apply
index f8bd664..b938a83 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -897,6 +897,8 @@ calc-perf-copy-table-flags.diff, n#514156, kohei
 # less than 1000.
 calc-perf-rowheight-no-progress-bar.diff, n#514156, kohei
 
+# speed up row's hidden state query during pagenation.
+calc-perf-page-and-manual-breaks-fwd-iterator.diff, n#503482, kohei
 
 [ LinuxOnly ]
 # accelerate linking, by extreme cunning i#63927
diff --git a/patches/dev300/calc-perf-page-and-manual-breaks-fwd-iterator.diff b/patches/dev300/calc-perf-page-and-manual-breaks-fwd-iterator.diff
new file mode 100644
index 0000000..a0cd65b
--- /dev/null
+++ b/patches/dev300/calc-perf-page-and-manual-breaks-fwd-iterator.diff
@@ -0,0 +1,86 @@
+diff --git sc/inc/segmenttree.hxx sc/inc/segmenttree.hxx
+index 466f9ed..64ba898 100644
+--- sc/inc/segmenttree.hxx
++++ sc/inc/segmenttree.hxx
+@@ -46,6 +46,22 @@ public:
+         SCROW   mnRow2;
+         bool    mbValue;
+     };
++
++    class ForwardIterator
++    {
++    public:
++        explicit ForwardIterator(ScFlatBoolRowSegments& rSegs);
++
++        bool getValue(SCROW nPos, bool& rVal);
++
++    private:
++        ScFlatBoolRowSegments&  mrSegs;
++
++        SCROW   mnCurPos;
++        SCROW   mnLastPos;
++        bool    mbCurValue;
++    };
++
+     ScFlatBoolRowSegments();
+     ~ScFlatBoolRowSegments();
+ 
+diff --git sc/source/core/data/segmenttree.cxx sc/source/core/data/segmenttree.cxx
+index be8e408..0ee889b 100644
+--- sc/source/core/data/segmenttree.cxx
++++ sc/source/core/data/segmenttree.cxx
+@@ -130,6 +130,34 @@ void ScFlatBoolSegmentsImpl::insertSegment(SCCOLROW nPos, SCCOLROW nSize, bool b
+ 
+ // ============================================================================
+ 
++ScFlatBoolRowSegments::ForwardIterator::ForwardIterator(ScFlatBoolRowSegments& rSegs) :
++    mrSegs(rSegs), mnCurPos(0), mnLastPos(-1), mbCurValue(false)
++{
++}
++
++bool ScFlatBoolRowSegments::ForwardIterator::getValue(SCROW nPos, bool& rVal)
++{
++    if (nPos >= mnCurPos)
++        // It can only go in a forward direction.
++        mnCurPos = nPos;
++
++    if (mnCurPos > mnLastPos)
++    {
++        // position not in the current segment.  Update the current value.
++        ScFlatBoolRowSegments::RangeData aData;
++        if (!mrSegs.getRangeData(mnCurPos, aData))
++            return false;
++    
++        mbCurValue = aData.mbValue;
++        mnLastPos = aData.mnRow2;
++    }
++
++    rVal = mbCurValue;
++    return true;
++}
++
++// ----------------------------------------------------------------------------
++
+ ScFlatBoolRowSegments::ScFlatBoolRowSegments() :
+     mpImpl(new ScFlatBoolSegmentsImpl(static_cast<SCCOLROW>(MAXROW)))
+ {
+diff --git sc/source/core/data/table5.cxx sc/source/core/data/table5.cxx
+index 7e7cab9..4d28ff2 100644
+--- sc/source/core/data/table5.cxx
++++ sc/source/core/data/table5.cxx
+@@ -203,10 +203,14 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea )
+     BOOL bRepeatRow = ( nRepeatStartY != SCROW_REPEAT_NONE );
+     BOOL bRowFound = FALSE;
+     long nSizeY = 0;
++    ScFlatBoolRowSegments::ForwardIterator aIter(*mpHiddenRows);
+     for (SCROW nY = nStartRow; nY <= nEndRow; ++nY)
+     {
+         BOOL bStartOfPage = FALSE;
+-        long nThisY = RowHidden(nY) ? 0 : pRowHeight->GetValue(nY);
++        bool bThisRowHidden = false;
++        aIter.getValue(nY, bThisRowHidden);
++        long nThisY = bThisRowHidden ? 0 : pRowHeight->GetValue(nY);
++
+         bool bManualBreak = HasRowManualBreak(nY);
+ 		if ( (nSizeY+nThisY > nPageSizeY) || (bManualBreak && !bSkipBreaks) )
+         {


More information about the ooo-build-commit mailing list