[Libreoffice-commits] .: sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Feb 14 18:36:24 PST 2011


 sc/inc/segmenttree.hxx              |    2 --
 sc/source/core/data/segmenttree.cxx |   36 +++---------------------------------
 sc/source/core/data/table1.cxx      |    1 -
 sc/source/core/data/table2.cxx      |    5 -----
 4 files changed, 3 insertions(+), 41 deletions(-)

New commits:
commit 95293e9a9f65d3143550d9d558a37b72098d41c7
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Mon Feb 14 21:35:20 2011 -0500

    With positional insert, there is no need to do back insertion.
    
    My benchmark shows that positional insertion is slightly faster
    than back insertion.  Let's remove back insertion calls to keep
    the API cleaner.

diff --git a/sc/inc/segmenttree.hxx b/sc/inc/segmenttree.hxx
index d05b6b3..353250e 100644
--- a/sc/inc/segmenttree.hxx
+++ b/sc/inc/segmenttree.hxx
@@ -112,7 +112,6 @@ public:
     void insertSegment(SCCOL nCol, SCCOL nSize, bool bSkipStartBoundary);
 
     void enableTreeSearch(bool bEnable);
-    void setInsertFromBack(bool bInsertFromBack);
 
 private:
     ::std::auto_ptr<ScFlatBoolSegmentsImpl> mpImpl;
@@ -162,7 +161,6 @@ public:
     SCROW findLastNotOf(sal_uInt16 nValue) const;
 
     void enableTreeSearch(bool bEnable);
-    void setInsertFromBack(bool bInsertFromBack);
 
 private:
     ::std::auto_ptr<ScFlatUInt16SegmentsImpl> mpImpl;
diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx
index 22ec42c..da584e3 100644
--- a/sc/source/core/data/segmenttree.cxx
+++ b/sc/source/core/data/segmenttree.cxx
@@ -76,33 +76,25 @@ public:
         mbTreeSearchEnabled = b;
     }
 
-    void setInsertFromBack(bool b)
-    {
-        mbInsertFromBack = b;
-    }
-
 private:
     typedef ::mdds::flat_segment_tree<SCCOLROW, ValueType> fst_type;
     fst_type maSegments;
     typename fst_type::const_iterator maItr;
 
     bool mbTreeSearchEnabled:1;
-    bool mbInsertFromBack:1;
 };
 
 template<typename _ValueType, typename _ExtValueType>
 ScFlatSegmentsImpl<_ValueType, _ExtValueType>::ScFlatSegmentsImpl(SCCOLROW nMax, ValueType nDefault) :
     maSegments(0, nMax+1, nDefault),
-    mbTreeSearchEnabled(true),
-    mbInsertFromBack(false)
+    mbTreeSearchEnabled(true)
 {
 }
 
 template<typename _ValueType, typename _ExtValueType>
 ScFlatSegmentsImpl<_ValueType, _ExtValueType>::ScFlatSegmentsImpl(const ScFlatSegmentsImpl<_ValueType, _ExtValueType>& r) :
     maSegments(r.maSegments),
-    mbTreeSearchEnabled(r.mbTreeSearchEnabled),
-    mbInsertFromBack(r.mbInsertFromBack)
+    mbTreeSearchEnabled(r.mbTreeSearchEnabled)
 {
 }
 
@@ -115,11 +107,7 @@ template<typename _ValueType, typename _ExtValueType>
 bool ScFlatSegmentsImpl<_ValueType, _ExtValueType>::setValue(SCCOLROW nPos1, SCCOLROW nPos2, ValueType nValue)
 {
     ::std::pair<typename fst_type::const_iterator, bool> ret;
-    if (mbInsertFromBack)
-        ret = maSegments.insert_back(nPos1, nPos2+1, nValue);
-    else
-        ret = maSegments.insert(maItr, nPos1, nPos2+1, nValue);
-
+    ret = maSegments.insert(maItr, nPos1, nPos2+1, nValue);
     maItr = ret.first;
     return ret.second;
 }
@@ -424,11 +412,6 @@ void ScFlatBoolRowSegments::enableTreeSearch(bool bEnable)
     mpImpl->enableTreeSearch(bEnable);
 }
 
-void ScFlatBoolRowSegments::setInsertFromBack(bool bEnable)
-{
-    mpImpl->setInsertFromBack(bEnable);
-}
-
 SCROW ScFlatBoolRowSegments::findLastNotOf(bool bValue) const
 {
     return static_cast<SCROW>(mpImpl->findLastNotOf(bValue));
@@ -487,14 +470,6 @@ void ScFlatBoolColSegments::enableTreeSearch(bool bEnable)
     mpImpl->enableTreeSearch(bEnable);
 }
 
-void ScFlatBoolColSegments::setInsertFromBack(bool bInsertFromBack)
-{
-    mpImpl->setInsertFromBack(bInsertFromBack);
-}
-
-// ============================================================================
-
-
 // ============================================================================
 
 ScFlatUInt16RowSegments::ForwardIterator::ForwardIterator(ScFlatUInt16RowSegments& rSegs) :
@@ -591,9 +566,4 @@ void ScFlatUInt16RowSegments::enableTreeSearch(bool bEnable)
     mpImpl->enableTreeSearch(bEnable);
 }
 
-void ScFlatUInt16RowSegments::setInsertFromBack(bool bInsertFromBack)
-{
-    mpImpl->setInsertFromBack(bInsertFromBack);
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 036dae0..464c965 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1487,7 +1487,6 @@ void ScTable::ExtendPrintArea( OutputDevice* pDev,
     // First, mark those columns that we need to skip i.e. hidden and empty columns.
 
     ScFlatBoolColSegments aSkipCols;
-    aSkipCols.setInsertFromBack(true); // speed optimazation.
     aSkipCols.setFalse(0, MAXCOL);
     for (SCCOL i = 0; i <= MAXCOL; ++i)
     {
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index a881598..8d91fd8 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1234,11 +1234,6 @@ void ScTable::SetRelNameDirty()
 void ScTable::SetLoadingMedium(bool bLoading)
 {
     mpRowHeights->enableTreeSearch(!bLoading);
-
-    // When loading a medium, prefer inserting row heights from the back
-    // position since the row heights are stored and read in ascending order
-    // during import.
-    mpRowHeights->setInsertFromBack(bLoading);
 }
 
 


More information about the Libreoffice-commits mailing list