sc/source/core/data/table2.cxx           |    3 +--
 sc/source/filter/oox/sheetdatabuffer.cxx |    9 ++++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 4728edd282cdbe756ff39c06310f2937a9beb45c
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Sun Jun 4 18:53:03 2023 +0200
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Jun 28 17:32:17 2023 +0200

    sort row-range-styles
    
    which reduces the amount of data-movement we do in the following loop
    when inserting into the sorted_vector.
    Shaves 2% off the load time of a large document with lots of styles.
    
    Change-Id: I8df4cc35edcc212613068af108b136c2d5acd219
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152600
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153586
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx 
b/sc/source/filter/oox/sheetdatabuffer.cxx
index ff1828b5591f..0fc56fe77a24 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -393,10 +393,17 @@ void SheetDataBuffer::addColXfStyleProcessRowRanges()
     for ( sal_Int32 nCol = 0; nCol <= nMaxCol; ++nCol )
     {
         RowStyles& rRowStyles = maStylesPerColumn[ nCol ];
-        for ( const auto& [nXfId, rRowRangeList] : maXfIdRowRangeList )
+        for ( auto& [nXfId, rRowRangeList] : maXfIdRowRangeList )
         {
             if ( nXfId == -1 ) // it's a dud skip it
                 continue;
+            // sort the row ranges, so we spend less time moving data around
+            // when we insert into aStyleRows
+            std::sort(rRowRangeList.begin(), rRowRangeList.end(),
+                [](const ValueRange& lhs, const ValueRange& rhs)
+                {
+                    return lhs.mnFirst < rhs.mnFirst;
+                });
             // get all row ranges for id
             for ( const auto& rRange : rRowRangeList )
             {
commit cebc90f3cf0a1dfa6f4f682dc9fff8d2fecfdd28
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jun 2 20:51:53 2023 +0200
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Jun 28 17:32:07 2023 +0200

    remove unnecessary ScPatternAttr copy
    
    slightly speeds up loading document with large number of patterns
    
    Change-Id: I1b82145fb0f8a62da0d5a46a43594f7085ce2c22
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152564
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    (cherry picked from commit c01fa7ff3bcd3447ea190bcc1833beb7c48a8803)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152535
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153585
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 3ed331fbc908..ebe63974cbbc 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2915,8 +2915,7 @@ namespace
         std::vector<ScAttrEntry> aData(rOrigData);
         for (size_t nIdx = 0; nIdx < aData.size(); ++nIdx)
         {
-            ScPatternAttr aNewPattern(*aData[nIdx].pPattern);
-            aData[nIdx].pPattern = &rDocument.GetPool()->Put(aNewPattern);
+            aData[nIdx].pPattern = 
&rDocument.GetPool()->Put(*aData[nIdx].pPattern);
         }
         return aData;
     }

Reply via email to