[Libreoffice-commits] core.git: sc/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 31 08:35:12 UTC 2019


 sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx |   20 ++++++++---------
 sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx |   16 ++++++-------
 2 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 9db70dfdc8d1851415f9d90fc192551178973f43
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Oct 31 08:07:08 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Oct 31 09:34:36 2019 +0100

    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 at collabora.co.uk>

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);


More information about the Libreoffice-commits mailing list