summaryrefslogtreecommitdiff
path: root/sc/source/core/data
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-02-14 21:35:20 -0500
committerKohei Yoshida <kyoshida@novell.com>2011-02-14 21:35:20 -0500
commit95293e9a9f65d3143550d9d558a37b72098d41c7 (patch)
tree4c4c29d7b1c26ad40cc5908716caaaf786ce9e3c /sc/source/core/data
parente04a42c7dea497c0a4e6159ed5c33910c16a51ca (diff)
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.
Diffstat (limited to 'sc/source/core/data')
-rw-r--r--sc/source/core/data/segmenttree.cxx36
-rw-r--r--sc/source/core/data/table1.cxx1
-rw-r--r--sc/source/core/data/table2.cxx5
3 files changed, 3 insertions, 39 deletions
diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx
index 22ec42c3c..da584e3f1 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 036dae0ab..464c9650a 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 a881598f2..8d91fd8a8 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);
}