diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-23 12:09:45 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2020-06-30 10:15:05 +0100 |
commit | 8922d83a070c06485a7d62447a79178a5b4fb27f (patch) | |
tree | 78e262a50f5466d04703482361511459e98d655d /sc | |
parent | 86305ecbc67cb8260fa56ecd6cb39a66c2dd75a3 (diff) |
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@collabora.co.uk>
(cherry picked from commit 97965876459d8cfda0b653551708eb14de36e632)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96885
(cherry picked from commit 0638adcb101d870b169a34d980d41ef4fc742a94)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96996
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/column4.cxx | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index a06dc0f0d939..7acd4b0a9183 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -1220,8 +1220,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()); } }; |