[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sc/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 24 07:19:06 UTC 2020


 sc/source/core/data/column4.cxx |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 0638adcb101d870b169a34d980d41ef4fc742a94
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jun 23 12:09:45 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jun 24 09:18:33 2020 +0200

    tdf#133699 Slow sorting of a column
    
    reserve inside a loop is a pessimization, since it breaks the
    logarithmic resizing of the std::vector data area.
    
    Also use the std::vector::insert method, instead of std::copy, since
    the insert method will perform less resizing operations.
    
    On my machine, this takes the sort operation from 25s to less than 1s.
    
    Change-Id: I30b99d42c56abc5a4ad5c133c7579fac3952173c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96929
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit 97965876459d8cfda0b653551708eb14de36e632)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96885

diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 3ca9a2892357..06f4684a5acd 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -1221,8 +1221,7 @@ public:
     void operator() ( size_t /*nRow*/, SvtBroadcaster* p )
     {
         SvtBroadcaster::ListenersType& rLis = p->GetAllListeners();
-        mrListeners.reserve(mrListeners.size() + rLis.size());
-        std::copy(rLis.begin(), rLis.end(), std::back_inserter(mrListeners));
+        mrListeners.insert(mrListeners.end(), rLis.begin(), rLis.end());
     }
 };
 


More information about the Libreoffice-commits mailing list