include/svl/sharedstring.hxx   |   12 ++----------
 sc/inc/table.hxx               |    3 ++-
 sc/source/core/data/table6.cxx |   21 ++++++++++++++-------
 3 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 2da1cdd31312a70f205f29bb4dfcbc1771409aa4
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue Jun 14 18:44:40 2022 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Wed Jun 15 09:24:28 2022 +0200

    simplify SharedString::operator=(&&)
    
    the release will happen in the destructor
    
    Change-Id: Ibb1f2ca11a157affdcfa9e0959558945657caa21
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135856
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/include/svl/sharedstring.hxx b/include/svl/sharedstring.hxx
index 5b5c35b95a92..cef5e410e2cf 100644
--- a/include/svl/sharedstring.hxx
+++ b/include/svl/sharedstring.hxx
@@ -92,16 +92,8 @@ inline SharedString& SharedString::operator=(SharedString&& 
r) noexcept
 {
     // Having this inline helps Calc's mdds::multi_type_vector to do some 
operations
     // much faster.
-    if (mpData)
-        rtl_uString_release(mpData);
-    if (mpDataIgnoreCase)
-        rtl_uString_release(mpDataIgnoreCase);
-
-    mpData = r.mpData;
-    mpDataIgnoreCase = r.mpDataIgnoreCase;
-
-    r.mpData = nullptr;
-    r.mpDataIgnoreCase = nullptr;
+    std::swap(mpData, r.mpData);
+    std::swap(mpDataIgnoreCase, r.mpDataIgnoreCase);
 
     return *this;
 }
commit 1cc9f4d972f8a5e1e3f4980942e128dee9a2701c
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue Jun 14 18:44:02 2022 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Wed Jun 15 09:24:17 2022 +0200

    tdf#126109 calc slow when replacing string to number
    
    retain the column block iterator array during the process, shaves 20%
    off the time
    
    Change-Id: Id492cf142ecc34af6fd236135d87f49b5a630d5e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135855
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 7360b3da6921..da1c0a4d4e98 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -1188,7 +1188,8 @@ private:
                        const ScMarkData& rMark, OUString& rUndoStr, 
ScDocument* pUndoDoc);
     bool        Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& 
rRow,
                        SCCOL nLastCol, SCROW nLastRow,
-                       const ScMarkData& rMark, OUString& rUndoStr, 
ScDocument* pUndoDoc);
+                       const ScMarkData& rMark, OUString& rUndoStr, 
ScDocument* pUndoDoc,
+                       std::vector< sc::ColumnBlockConstPosition >& blockPos);
     bool        SearchAll(const SvxSearchItem& rSearchItem, const ScMarkData& 
rMark,
                           ScRangeList& rMatchedRanges, OUString& rUndoStr, 
ScDocument* pUndoDoc);
     bool        Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& 
rRow,
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 0ced56900d6d..966b4491c348 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -323,12 +323,14 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, 
SCCOL& rCol, SCROW& rRow,
         GetCellArea( nLastCol, nLastRow);
     else
         GetLastDataPos(nLastCol, nLastRow);
-    return Search(rSearchItem, rCol, rRow, nLastCol, nLastRow, rMark, 
rUndoStr, pUndoDoc);
+    std::vector< sc::ColumnBlockConstPosition > blockPos;
+    return Search(rSearchItem, rCol, rRow, nLastCol, nLastRow, rMark, 
rUndoStr, pUndoDoc, blockPos);
 }
 
 bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& 
rRow,
                      SCCOL nLastCol, SCROW nLastRow,
-                     const ScMarkData& rMark, OUString& rUndoStr, ScDocument* 
pUndoDoc)
+                     const ScMarkData& rMark, OUString& rUndoStr, ScDocument* 
pUndoDoc,
+                     std::vector< sc::ColumnBlockConstPosition >& blockPos)
 {
     bool bFound = false;
     bool bAll =  (rSearchItem.GetCommand() == SvxSearchCmd::FIND_ALL)
@@ -339,9 +341,12 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, 
SCCOL& rCol, SCROW& rRow,
     bool bSkipFiltered = !rSearchItem.IsSearchFiltered();
     bool bSearchNotes = (rSearchItem.GetCellType() == SvxSearchCellType::NOTE);
     // We need to cache sc::ColumnBlockConstPosition per each column.
-    std::vector< sc::ColumnBlockConstPosition > blockPos( nLastCol + 1 );
-    for( SCCOL i = 0; i <= nLastCol; ++i )
-        aCol[ i ].InitBlockPosition( blockPos[ i ] );
+    if (static_cast<SCCOL>(blockPos.size()) != nLastCol + 1)
+    {
+        blockPos.resize( nLastCol + 1 );
+        for( SCCOL i = 0; i <= nLastCol; ++i )
+            aCol[ i ].InitBlockPosition( blockPos[ i ] );
+    }
     if (!bAll && rSearchItem.GetBackward())
     {
         SCROW nLastNonFilteredRow = rDocument.MaxRow() + 1;
@@ -529,9 +534,10 @@ bool ScTable::SearchAll(const SvxSearchItem& rSearchItem, 
const ScMarkData& rMar
     else
         GetLastDataPos(nLastCol, nLastRow);
 
+    std::vector< sc::ColumnBlockConstPosition > blockPos;
     do
     {
-        bFound = Search(rSearchItem, nCol, nRow, nLastCol, nLastRow, rMark, 
rUndoStr, pUndoDoc);
+        bFound = Search(rSearchItem, nCol, nRow, nLastCol, nLastRow, rMark, 
rUndoStr, pUndoDoc, blockPos);
         if (bFound)
         {
             bEverFound = true;
@@ -595,10 +601,11 @@ bool ScTable::ReplaceAll(
     SvxSearchItem aCopyItem(rSearchItem);
     aCopyItem.SetRowDirection(false);
 
+    std::vector< sc::ColumnBlockConstPosition > blockPos;
     bool bEverFound = false;
     while (true)
     {
-        bool bFound = Search(aCopyItem, nCol, nRow, nLastCol, nLastRow, rMark, 
rUndoStr, pUndoDoc);
+        bool bFound = Search(aCopyItem, nCol, nRow, nLastCol, nLastRow, rMark, 
rUndoStr, pUndoDoc, blockPos);
 
         if (bFound)
         {

Reply via email to