diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-31 08:07:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-31 09:34:36 +0100 |
commit | 9db70dfdc8d1851415f9d90fc192551178973f43 (patch) | |
tree | 0b44237c75eb6439a43f80aa5609250a282d4963 | |
parent | 333fbcf5ef8e80449af0c164498335bc24f16243 (diff) |
tdf#125688, deque->vector
shaves 5% off load time
Change-Id: I555ce09d12f801c9d69efb816f9389e27ca396cc
Reviewed-on: https://gerrit.libreoffice.org/81818
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx | 20 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx | 16 |
2 files changed, 18 insertions, 18 deletions
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx index a7f141c832f8..a9a7cb3f126c 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx @@ -267,12 +267,12 @@ void ScXMLChangeTrackingImportHelper::SetPosition(const sal_Int32 nPosition, con void ScXMLChangeTrackingImportHelper::AddDeleted(const sal_uInt32 nID) { - pCurrentAction->aDeletedList.emplace_front( nID, nullptr ); + pCurrentAction->aDeletedList.emplace_back( nID, nullptr ); } void ScXMLChangeTrackingImportHelper::AddDeleted(const sal_uInt32 nID, std::unique_ptr<ScMyCellInfo> pCellInfo) { - pCurrentAction->aDeletedList.emplace_front( nID, std::move(pCellInfo) ); + pCurrentAction->aDeletedList.emplace_back( nID, std::move(pCellInfo) ); } void ScXMLChangeTrackingImportHelper::SetMultiSpanned(const sal_Int16 nTempMultiSpanned) @@ -304,7 +304,7 @@ void ScXMLChangeTrackingImportHelper::AddMoveCutOff(const sal_uInt32 nID, const if ((pCurrentAction->nActionType == SC_CAT_DELETE_COLS) || (pCurrentAction->nActionType == SC_CAT_DELETE_ROWS)) { - static_cast<ScMyDelAction*>(pCurrentAction.get())->aMoveCutOffs.push_front(ScMyMoveCutOff(nID, nStartPosition, nEndPosition)); + static_cast<ScMyDelAction*>(pCurrentAction.get())->aMoveCutOffs.push_back(ScMyMoveCutOff(nID, nStartPosition, nEndPosition)); } else { @@ -478,7 +478,7 @@ std::unique_ptr<ScChangeAction> ScXMLChangeTrackingImportHelper::CreateContentAc pAction->aBigRange, aUser, aDateTime, sComment, aCell, pDoc, sInputString); } -void ScXMLChangeTrackingImportHelper::CreateGeneratedActions(std::deque<ScMyGenerated>& rList) +void ScXMLChangeTrackingImportHelper::CreateGeneratedActions(std::vector<ScMyGenerated>& rList) { for (ScMyGenerated & rGenerated : rList) { @@ -536,8 +536,9 @@ void ScXMLChangeTrackingImportHelper::SetDeletionDependencies(ScMyDelAction* pAc OSL_ENSURE(((pAction->nActionType == SC_CAT_DELETE_COLS) || (pAction->nActionType == SC_CAT_DELETE_ROWS) || (pAction->nActionType == SC_CAT_DELETE_TABS)), "wrong action type"); - for (const ScMyMoveCutOff & rCutOff : pAction->aMoveCutOffs) + for (auto it = pAction->aMoveCutOffs.crbegin(); it != pAction->aMoveCutOffs.crend(); ++it) { + const ScMyMoveCutOff & rCutOff = *it; ScChangeAction* pChangeAction = pTrack->GetAction(rCutOff.nID); if (pChangeAction && (pChangeAction->GetType() == SC_CAT_MOVE)) { @@ -602,16 +603,15 @@ void ScXMLChangeTrackingImportHelper::SetDependencies(ScMyBaseAction* pAction) { if (!pAction->aDependencies.empty()) { - for (const auto & rID : pAction->aDependencies) - { - pAct->AddDependent(rID, pTrack); - } + for (auto it = pAction->aDependencies.crbegin(); it != pAction->aDependencies.crend(); ++it) + pAct->AddDependent(*it, pTrack); pAction->aDependencies.clear(); } if (!pAction->aDeletedList.empty()) { - for(const ScMyDeleted & rDeleted : pAction->aDeletedList) + for (auto it = pAction->aDeletedList.crbegin(); it != pAction->aDeletedList.crend(); ++it) { + const ScMyDeleted & rDeleted = *it; pAct->SetDeletedInThis(rDeleted.nID, pTrack); ScChangeAction* pDeletedAct = pTrack->GetAction(rDeleted.nID); if ((pDeletedAct->GetType() == SC_CAT_CONTENT) && rDeleted.pCellInfo) diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx index 75f1c9d6e56e..0fc08a705703 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx @@ -108,8 +108,8 @@ struct ScMyBaseAction { ScMyActionInfo aInfo; ScBigRange aBigRange; - std::deque<sal_uInt32> aDependencies; - std::deque<ScMyDeleted> aDeletedList; + std::vector<sal_uInt32> aDependencies; + std::vector<ScMyDeleted> aDeletedList; sal_uInt32 nActionNumber; sal_uInt32 nRejectingNumber; sal_uInt32 nPreviousAction; @@ -128,9 +128,9 @@ struct ScMyInsAction : public ScMyBaseAction struct ScMyDelAction : public ScMyBaseAction { - std::deque<ScMyGenerated> aGeneratedList; + std::vector<ScMyGenerated> aGeneratedList; std::unique_ptr<ScMyInsertionCutOff> pInsCutOff; - std::deque<ScMyMoveCutOff> aMoveCutOffs; + std::vector<ScMyMoveCutOff> aMoveCutOffs; sal_Int32 nD; explicit ScMyDelAction(const ScChangeActionType nActionType); @@ -139,7 +139,7 @@ struct ScMyDelAction : public ScMyBaseAction struct ScMyMoveAction : public ScMyBaseAction { - std::deque<ScMyGenerated> aGeneratedList; + std::vector<ScMyGenerated> aGeneratedList; std::unique_ptr<ScMyMoveRanges> pMoveRanges; ScMyMoveAction(); @@ -163,7 +163,7 @@ struct ScMyRejAction : public ScMyBaseAction class ScXMLChangeTrackingImportHelper { std::set<OUString> aUsers; - std::deque<std::unique_ptr<ScMyBaseAction>> aActions; + std::vector<std::unique_ptr<ScMyBaseAction>> aActions; css::uno::Sequence<sal_Int8> aProtect; ScDocument* pDoc; ScChangeTrack* pTrack; @@ -179,7 +179,7 @@ private: std::unique_ptr<ScChangeAction> CreateRejectionAction(const ScMyRejAction* pAction); std::unique_ptr<ScChangeAction> CreateContentAction(const ScMyContentAction* pAction); - void CreateGeneratedActions(std::deque<ScMyGenerated>& rList); + void CreateGeneratedActions(std::vector<ScMyGenerated>& rList); public: ScXMLChangeTrackingImportHelper(); @@ -197,7 +197,7 @@ public: void SetBigRange(const ScBigRange& aBigRange) { pCurrentAction->aBigRange = aBigRange; } void SetPreviousChange(const sal_uInt32 nPreviousAction, ScMyCellInfo* pCellInfo); void SetPosition(const sal_Int32 nPosition, const sal_Int32 nCount, const sal_Int32 nTable); - void AddDependence(const sal_uInt32 nID) { pCurrentAction->aDependencies.push_front(nID); } + void AddDependence(const sal_uInt32 nID) { pCurrentAction->aDependencies.push_back(nID); } void AddDeleted(const sal_uInt32 nID); void AddDeleted(const sal_uInt32 nID, std::unique_ptr<ScMyCellInfo> pCellInfo); void SetMultiSpanned(const sal_Int16 nMultiSpanned); |