sc/inc/dpcache.hxx | 16 ++++------------ sc/source/core/data/dpcache.cxx | 31 ++----------------------------- 2 files changed, 6 insertions(+), 41 deletions(-)
New commits: commit 0c1a63b1fbbd9540a724f6918675a5559b19c156 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Thu Mar 15 20:30:52 2012 -0400 No need to trim capacity any more; it's allocated to the exact size. diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index 4c93501..928e511 100644 --- a/sc/source/core/data/dpcache.cxx +++ b/sc/source/core/data/dpcache.cxx @@ -756,12 +756,6 @@ public: void ScDPCache::PostInit() { maEmptyRows.build_tree(); - FieldsType::iterator it = maFields.begin(), itEnd = maFields.end(); - for (; it != itEnd; ++it) - { - // Trim excess capacity. - ItemsType(it->maItems).swap(it->maItems); - } } void ScDPCache::Clear() commit 9e19cf80c080929c914dc0bfa069f22c8526c3b0 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Thu Mar 15 20:23:10 2012 -0400 We don't need these extra order index array; items are already sorted. This shaves off extra 5MB of memory with my test document. diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx index 6566979..1e26688 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 08b0d25..4c93501 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 _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits