tdf#125254 Performance: A spreadsheet opens too slow, part1

This takes the opening time from 55s to 48s for me.

Change-Id: Ia60fff33e9948e0bd6906c82b48aa30f8b2551bb
Reviewed-on: https://gerrit.libreoffice.org/72394
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2019-05-13 16:28:14 +02:00
parent 4b04eae814
commit b27755b704
3 changed files with 10 additions and 5 deletions

View File

@@ -113,6 +113,11 @@ public:
m_vector.clear();
}
void swap(sorted_vector & other)
{
m_vector.swap(other.m_vector);
}
void reserve(size_type amount)
{
m_vector.reserve(amount);

View File

@@ -21,7 +21,7 @@
#include <svl/svldllapi.h>
#include <unordered_set>
#include <o3tl/sorted_vector.hxx>
class SvtBroadcaster;
class SfxHint;
@@ -29,7 +29,7 @@ class SfxHint;
class SVL_DLLPUBLIC SvtListener
{
friend class SvtBroadcaster;
typedef std::unordered_set<SvtBroadcaster*> BroadcastersType;
typedef o3tl::sorted_vector<SvtBroadcaster*> BroadcastersType;
BroadcastersType maBroadcasters;
const SvtListener& operator=(const SvtListener &) = delete;

View File

@@ -43,7 +43,7 @@ SvtListener::~SvtListener() COVERITY_NOEXCEPT_FALSE
bool SvtListener::StartListening( SvtBroadcaster& rBroadcaster )
{
std::pair<BroadcastersType::iterator, bool> r =
std::pair<BroadcastersType::const_iterator, bool> r =
maBroadcasters.insert(&rBroadcaster);
if (r.second)
{
@@ -55,7 +55,7 @@ bool SvtListener::StartListening( SvtBroadcaster& rBroadcaster )
bool SvtListener::EndListening( SvtBroadcaster& rBroadcaster )
{
BroadcastersType::iterator it = maBroadcasters.find(&rBroadcaster);
BroadcastersType::const_iterator it = maBroadcasters.find(&rBroadcaster);
if (it == maBroadcasters.end())
// Not listening to this broadcaster.
return false;
@@ -69,7 +69,7 @@ bool SvtListener::EndListening( SvtBroadcaster& rBroadcaster )
// back into the broadcaster again
void SvtListener::BroadcasterDying( SvtBroadcaster& rBroadcaster )
{
BroadcastersType::iterator it = maBroadcasters.find(&rBroadcaster);
BroadcastersType::const_iterator it = maBroadcasters.find(&rBroadcaster);
if (it != maBroadcasters.end())
maBroadcasters.erase(it);
}