summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-03-15 20:23:10 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-03-15 21:54:06 -0400
commit9e19cf80c080929c914dc0bfa069f22c8526c3b0 (patch)
tree584a3f5c7f8ac01c3078e3b25b80d077956dc2ba
parentdbf3b4ab772a398ba397ea763deb6003adaf0586 (diff)
We don't need these extra order index array; items are already sorted.
This shaves off extra 5MB of memory with my test document.
-rw-r--r--sc/inc/dpcache.hxx16
-rw-r--r--sc/source/core/data/dpcache.cxx25
2 files changed, 6 insertions, 35 deletions
diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index 65669791cbe1..1e26688890f1 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -80,7 +80,10 @@ public:
*/
boost::scoped_ptr<GroupItems> mpGroup;
- ItemsType maItems; /// Unique values in the field.
+ /**
+ * Unique values in the field, stored in ascending order.
+ */
+ ItemsType maItems;
/**
* Original source data represented as indices to the unique value
@@ -89,17 +92,6 @@ public:
*/
IndexArrayType maData;
- /**
- * Ascending order of field items.
- */
- IndexArrayType maGlobalOrder;
-
- /**
- * Ranks of each unique data represented by their index. It's a
- * reverse mapping of item index to global order index.
- */
- mutable IndexArrayType maIndexOrder;
-
sal_uLong mnNumFormat;
Field();
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 08b0d2548475..4c935013de86 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -376,12 +376,6 @@ void processBuckets(std::vector<Bucket>& aBuckets, ScDPCache::Field& rField)
size_t nLen = distance(itBeg, itUniqueEnd);
rField.maItems.reserve(nLen);
std::for_each(itBeg, itUniqueEnd, PushBackValue(rField.maItems));
-
- // The items are actually already sorted. So, just insert a sequence
- // of integers from 0 and up.
- rField.maGlobalOrder.reserve(nLen);
- for (size_t i = 0; i < nLen; ++i)
- rField.maGlobalOrder.push_back(i);
}
}
@@ -1120,24 +1114,9 @@ void ScDPCache::ClearGroupFields()
std::for_each(maFields.begin(), maFields.end(), ClearGroupItems());
}
-SCROW ScDPCache::GetOrder(long nDim, SCROW nIndex) const
+SCROW ScDPCache::GetOrder(long /*nDim*/, SCROW nIndex) const
{
- OSL_ENSURE( nDim >=0 && nDim < mnColumnCount, "ScDPTableDataCache::GetOrder : out of bound" );
-
- const Field& rField = maFields[nDim];
- if (rField.maIndexOrder.size() != rField.maGlobalOrder.size())
- { //not inited
- SCROW nRow = 0;
- rField.maIndexOrder.resize(rField.maGlobalOrder.size(), 0);
- for (size_t i = 0, n = rField.maGlobalOrder.size(); i < n; ++i)
- {
- nRow = rField.maGlobalOrder[i];
- rField.maIndexOrder[nRow] = i;
- }
- }
-
- OSL_ENSURE(nIndex >= 0 && sal::static_int_cast<sal_uInt32>(nIndex) < rField.maIndexOrder.size() , "ScDPTableDataCache::GetOrder");
- return rField.maIndexOrder[nIndex];
+ return nIndex;
}
ScDocument* ScDPCache::GetDoc() const