Kaydet (Commit) 57df32e4 authored tarafından Noel Grandin's avatar Noel Grandin

tdf#125254 Performance: A spreadsheet opens too slow, optimise listener

saves about 0.5s out of a 43s load

And remove the comment in EndListeningAll,
SfxBroadcaster::RemoveListener doesn't have any weird side-effects any

Change-Id: Id7c8ac1bed8ff3487cb8f977990d8fac351d7f03
Reviewed-on: https://gerrit.libreoffice.org/72396
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 04b055f1
......@@ -26,15 +26,13 @@
#include <algorithm>
#include <cassert>
#include <deque>
#include <vector>
#include <memory>
#include <map>
typedef std::deque<SfxBroadcaster*> SfxBroadcasterArr_Impl;
struct SfxListener::Impl
SfxBroadcasterArr_Impl maBCs;
std::vector<SfxBroadcaster*> maBCs;
#ifdef DBG_UTIL
std::map<SfxBroadcaster*, std::unique_ptr<sal::BacktraceState>>
......@@ -117,10 +115,10 @@ void SfxListener::StartListening(SfxBroadcaster& rBroadcaster, DuplicateHandling
void SfxListener::EndListening( SfxBroadcaster& rBroadcaster, bool bRemoveAllDuplicates )
SfxBroadcasterArr_Impl::iterator beginIt = mpImpl->maBCs.begin();
auto beginIt = mpImpl->maBCs.begin();
SfxBroadcasterArr_Impl::iterator it = std::find( beginIt, mpImpl->maBCs.end(), &rBroadcaster );
auto it = std::find( beginIt, mpImpl->maBCs.end(), &rBroadcaster );
if ( it == mpImpl->maBCs.end() )
......@@ -139,13 +137,10 @@ void SfxListener::EndListening( SfxBroadcaster& rBroadcaster, bool bRemoveAllDup
void SfxListener::EndListeningAll()
// Attention: when optimizing this: respect side effects of RemoveListener!
while ( !mpImpl->maBCs.empty() )
SfxBroadcaster *pBC = mpImpl->maBCs.front();
std::vector<SfxBroadcaster*> aBroadcasters;
std::swap(mpImpl->maBCs, aBroadcasters);
for (SfxBroadcaster *pBC : aBroadcasters)
#ifdef DBG_UTIL
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment