[Libreoffice-commits] core.git: 2 commits - package/source ucb/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 8 06:51:53 UTC 2019
package/source/manifest/ManifestImport.cxx | 8 +--
package/source/manifest/ManifestImport.hxx | 3 -
ucb/source/ucp/file/filprp.cxx | 2
ucb/source/ucp/file/filtask.cxx | 64 ++++++++++++-----------------
ucb/source/ucp/file/filtask.hxx | 4 -
5 files changed, 36 insertions(+), 45 deletions(-)
New commits:
commit 1d556ff84dce01531ee334dc1408cebe50e97d22
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Apr 5 15:39:25 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Apr 8 08:51:35 2019 +0200
tdf#117066 Saving ODT document with ~1500 bookmarks is slow, part 4
Individually, these don't make much difference, but they add up
to a halving the time to save on my machine.
fileaccess::TaskManager was spending lots of time iterating over it's
internal data, so flatten the structures here, to avoid cache-unfriendly
pointer chasing.
Change-Id: Ic1e2e3958d10f3266aad5ddbcbd68ef1c7285dc7
Reviewed-on: https://gerrit.libreoffice.org/70312
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/ucb/source/ucp/file/filprp.cxx b/ucb/source/ucp/file/filprp.cxx
index e0c6f5587971..4226832e068f 100644
--- a/ucb/source/ucp/file/filprp.cxx
+++ b/ucb/source/ucp/file/filprp.cxx
@@ -44,7 +44,7 @@ XPropertySetInfo_impl::XPropertySetInfo_impl( TaskManager* pMyShell,const OUStri
TaskManager::ContentMap::iterator it = m_pMyShell->m_aContent.find( aUnqPath );
- TaskManager::PropertySet& properties = *(it->second.properties);
+ TaskManager::PropertySet& properties = it->second.properties;
m_seq.realloc( properties.size() );
diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx
index b55b76c1e240..941c6d36634b 100644
--- a/ucb/source/ucp/file/filtask.cxx
+++ b/ucb/source/ucp/file/filtask.cxx
@@ -492,10 +492,7 @@ TaskManager::registerNotifier( const OUString& aUnqPath, Notifier* pNotifier )
ContentMap::iterator it =
m_aContent.emplace( aUnqPath, UnqPathData() ).first;
- if( ! it->second.notifier )
- it->second.notifier.reset( new NotifierList );
-
- std::vector< Notifier* >& nlist = *( it->second.notifier );
+ std::vector< Notifier* >& nlist = it->second.notifier;
std::vector<Notifier*>::iterator it1 = std::find(nlist.begin(), nlist.end(), pNotifier);
if( it1 != nlist.end() ) // Every "Notifier" only once
@@ -515,9 +512,9 @@ TaskManager::deregisterNotifier( const OUString& aUnqPath,Notifier* pNotifier )
if( it == m_aContent.end() )
return;
- it->second.notifier->erase(std::remove(it->second.notifier->begin(), it->second.notifier->end(), pNotifier), it->second.notifier->end());
+ it->second.notifier.erase(std::remove(it->second.notifier.begin(), it->second.notifier.end(), pNotifier), it->second.notifier.end());
- if( it->second.notifier->empty() )
+ if( it->second.notifier.empty() )
m_aContent.erase( it );
}
@@ -559,7 +556,7 @@ TaskManager::associate( const OUString& aUnqPath,
// Load the XPersistentPropertySetInfo and create it, if it does not exist
load( it,true );
- PropertySet& properties = *(it->second.properties);
+ PropertySet& properties = it->second.properties;
it1 = properties.find( newProperty );
if( it1 != properties.end() )
throw beans::PropertyExistException(THROW_WHERE );
@@ -588,7 +585,7 @@ TaskManager::deassociate( const OUString& aUnqPath,
load( it,false );
- PropertySet& properties = *(it->second.properties);
+ PropertySet& properties = it->second.properties;
it1 = properties.find( oldProperty );
if( it1 == properties.end() )
@@ -851,7 +848,7 @@ TaskManager::setv( const OUString& aUnqPath,
uno::Sequence< beans::PropertyChangeEvent > seqChanged( values.getLength() );
TaskManager::ContentMap::iterator it = m_aContent.find( aUnqPath );
- PropertySet& properties = *( it->second.properties );
+ PropertySet& properties = it->second.properties;
TaskManager::PropertySet::iterator it1;
uno::Any aAny;
@@ -1103,7 +1100,7 @@ TaskManager::getv( sal_Int32 CommandId,
commit( it,aFileStatus );
TaskManager::PropertySet::iterator it1;
- PropertySet& propset = *(it->second.properties);
+ PropertySet& propset = it->second.properties;
for( sal_Int32 i = 0; i < seq.getLength(); ++i )
{
@@ -1941,7 +1938,7 @@ void TaskManager::insertDefaultProperties( const OUString& aUnqPath )
MyProperty ContentTProperty( ContentType );
- PropertySet& properties = *(it->second.properties);
+ PropertySet& properties = it->second.properties;
bool ContentNotDefau = properties.find( ContentTProperty ) != properties.end();
for (auto const& defaultprop : m_aDefaultProperties)
@@ -2197,9 +2194,6 @@ TaskManager::getMaskFromProperties(
void
TaskManager::load( const ContentMap::iterator& it, bool create )
{
- if( ! it->second.properties )
- it->second.properties.reset( new PropertySet );
-
if( ( ! it->second.xS.is() ||
! it->second.xC.is() ||
! it->second.xA.is() )
@@ -2218,7 +2212,7 @@ TaskManager::load( const ContentMap::iterator& it, bool create )
// Now put in all values in the storage in the local hash;
- PropertySet& properties = *(it->second.properties);
+ PropertySet& properties = it->second.properties;
uno::Sequence< beans::Property > seq = xS->getPropertySetInfo()->getProperties();
for( sal_Int32 i = 0; i < seq.getLength(); ++i )
@@ -2258,13 +2252,13 @@ TaskManager::commit( const TaskManager::ContentMap::iterator& it,
{
TaskManager::PropertySet::iterator it1;
- if( it->second.properties == nullptr )
+ if( it->second.properties.empty() )
{
OUString aPath = it->first;
insertDefaultProperties( aPath );
}
- PropertySet& properties = *( it->second.properties );
+ PropertySet& properties = it->second.properties;
it1 = properties.find( MyProperty( Title ) );
if( it1 != properties.end() )
@@ -2532,7 +2526,7 @@ TaskManager::getv(
commit( it,aFileStatus );
TaskManager::PropertySet::iterator it1;
- PropertySet& propset = *(it->second.properties);
+ PropertySet& propset = it->second.properties;
for( sal_Int32 i = 0; i < seq.getLength(); ++i )
{
@@ -2562,9 +2556,9 @@ TaskManager::getContentEventListeners( const OUString& aName )
{
osl::MutexGuard aGuard( m_aMutex );
TaskManager::ContentMap::iterator it = m_aContent.find( aName );
- if( it != m_aContent.end() && it->second.notifier )
+ if( it != m_aContent.end() && !it->second.notifier.empty() )
{
- std::vector<Notifier*>& listOfNotifiers = *( it->second.notifier );
+ std::vector<Notifier*>& listOfNotifiers = it->second.notifier;
for (auto const& pointer : listOfNotifiers)
{
std::unique_ptr<ContentEventNotifier> notifier = pointer->cCEL();
@@ -2584,9 +2578,9 @@ TaskManager::getContentDeletedEventListeners( const OUString& aName )
{
osl::MutexGuard aGuard( m_aMutex );
TaskManager::ContentMap::iterator it = m_aContent.find( aName );
- if( it != m_aContent.end() && it->second.notifier )
+ if( it != m_aContent.end() && !it->second.notifier.empty() )
{
- std::vector<Notifier*>& listOfNotifiers = *( it->second.notifier );
+ std::vector<Notifier*>& listOfNotifiers = it->second.notifier;
for (auto const& pointer : listOfNotifiers)
{
std::unique_ptr<ContentEventNotifier> notifier = pointer->cDEL();
@@ -2633,9 +2627,9 @@ TaskManager::getPropertySetListeners( const OUString& aName )
{
osl::MutexGuard aGuard( m_aMutex );
TaskManager::ContentMap::iterator it = m_aContent.find( aName );
- if( it != m_aContent.end() && it->second.notifier )
+ if( it != m_aContent.end() && !it->second.notifier.empty() )
{
- std::vector<Notifier*>& listOfNotifiers = *( it->second.notifier );
+ std::vector<Notifier*>& listOfNotifiers = it->second.notifier;
for (auto const& pointer : listOfNotifiers)
{
std::unique_ptr<PropertySetInfoChangeNotifier> notifier = pointer->cPSL();
@@ -2720,14 +2714,15 @@ TaskManager::getContentExchangedEventListeners( const OUString& aOldPrefix,
itnew->second.properties = std::move(itold->second.properties);
// copy existing list
- std::unique_ptr<std::vector< Notifier* >> copyList = std::move(itnew->second.notifier);
+ std::vector< Notifier* > copyList;
+ std::swap(copyList, itnew->second.notifier);
itnew->second.notifier = std::move(itold->second.notifier);
m_aContent.erase( itold );
- if( itnew != m_aContent.end() && itnew->second.notifier )
+ if( itnew != m_aContent.end() && !itnew->second.notifier.empty() )
{
- std::vector<Notifier*>& listOfNotifiers = *( itnew->second.notifier );
+ std::vector<Notifier*>& listOfNotifiers = itnew->second.notifier;
for (auto const& pointer : listOfNotifiers)
{
std::unique_ptr<ContentEventNotifier> notifier = pointer->cEXC( aNewName );
@@ -2738,13 +2733,8 @@ TaskManager::getContentExchangedEventListeners( const OUString& aOldPrefix,
// Merge with preexisting notifiers
// However, these may be in status BaseContent::Deleted
- if( copyList != nullptr )
- {
- for( const auto& rCopyPtr : *copyList )
- {
- itnew->second.notifier->push_back( rCopyPtr );
- }
- }
+ for( const auto& rCopyPtr : copyList )
+ itnew->second.notifier.push_back( rCopyPtr );
}
}
}
@@ -2769,9 +2759,9 @@ TaskManager::getPropertyChangeNotifier( const OUString& aName )
{
osl::MutexGuard aGuard( m_aMutex );
TaskManager::ContentMap::iterator it = m_aContent.find( aName );
- if( it != m_aContent.end() && it->second.notifier )
+ if( it != m_aContent.end() && !it->second.notifier.empty() )
{
- std::vector<Notifier*>& listOfNotifiers = *( it->second.notifier );
+ std::vector<Notifier*>& listOfNotifiers = it->second.notifier;
for (auto const& pointer : listOfNotifiers)
{
std::unique_ptr<PropertyChangeNotifier> notifier = pointer->cPCL();
@@ -2841,7 +2831,7 @@ TaskManager::erasePersistentSet( const OUString& aUnqPath,
it->second.xC = nullptr;
it->second.xA = nullptr;
- it->second.properties.reset();
+ it->second.properties.clear();
}
}
diff --git a/ucb/source/ucp/file/filtask.hxx b/ucb/source/ucp/file/filtask.hxx
index 2c20b350b5f2..996aeba8865e 100644
--- a/ucb/source/ucp/file/filtask.hxx
+++ b/ucb/source/ucp/file/filtask.hxx
@@ -226,8 +226,8 @@ namespace fileaccess
UnqPathData(UnqPathData&&);
~UnqPathData();
- std::unique_ptr<PropertySet> properties;
- std::unique_ptr<NotifierList> notifier;
+ PropertySet properties;
+ NotifierList notifier;
// Three views on the PersistentPropertySet
css::uno::Reference< css::ucb::XPersistentPropertySet > xS;
commit c40a0d8c80a6b6d1354b0dc9695a8476a0a15599
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Apr 5 15:38:25 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Apr 8 08:51:31 2019 +0200
tdf#117066 Saving ODT document with ~1500 bookmarks is slow, part 3
Individually, these don't make much difference, but they add up
to a halving the time to save on my machine.
ManifestImport::characters was spending time adding data to an OUString,
so convert that to an OUStringBuffer.
Change-Id: I267e701f4e7998044763f44199b1fe8a37325b68
Reviewed-on: https://gerrit.libreoffice.org/70311
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx
index 7f2ef54bb293..b333cf5c9831 100644
--- a/package/source/manifest/ManifestImport.cxx
+++ b/package/source/manifest/ManifestImport.cxx
@@ -173,7 +173,7 @@ void ManifestImport::doEncryptedCipherValue()
{
aKeyInfoSequence[2].Name = "CipherValue";
uno::Sequence < sal_Int8 > aDecodeBuffer;
- ::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters);
+ ::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters.toString());
aKeyInfoSequence[2].Value <<= aDecodeBuffer;
aCurrentCharacters = ""; // consumed
}
@@ -187,7 +187,7 @@ void ManifestImport::doEncryptedKeyId()
{
aKeyInfoSequence[0].Name = "KeyId";
uno::Sequence < sal_Int8 > aDecodeBuffer;
- ::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters);
+ ::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters.toString());
aKeyInfoSequence[0].Value <<= aDecodeBuffer;
aCurrentCharacters = ""; // consumed
}
@@ -201,7 +201,7 @@ void ManifestImport::doEncryptedKeyPacket()
{
aKeyInfoSequence[1].Name = "KeyPacket";
uno::Sequence < sal_Int8 > aDecodeBuffer;
- ::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters);
+ ::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters.toString());
aKeyInfoSequence[1].Value <<= aDecodeBuffer;
aCurrentCharacters = ""; // consumed
}
@@ -510,7 +510,7 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName )
void SAL_CALL ManifestImport::characters( const OUString& aChars )
{
- aCurrentCharacters += aChars;
+ aCurrentCharacters.append(aChars);
}
void SAL_CALL ManifestImport::ignorableWhitespace( const OUString& /*aWhitespaces*/ )
diff --git a/package/source/manifest/ManifestImport.hxx b/package/source/manifest/ManifestImport.hxx
index 15023374bf71..671713d48ffd 100644
--- a/package/source/manifest/ManifestImport.hxx
+++ b/package/source/manifest/ManifestImport.hxx
@@ -24,6 +24,7 @@
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <vector>
+#include <rtl/ustrbuf.hxx>
#include <HashMaps.hxx>
@@ -54,7 +55,7 @@ class ManifestImport final : public cppu::WeakImplHelper < css::xml::sax::XDocum
std::vector< css::beans::NamedValue > aKeyInfoSequence;
std::vector< css::uno::Sequence< css::beans::NamedValue > > aKeys;
std::vector< css::beans::PropertyValue > aSequence;
- OUString aCurrentCharacters;
+ OUStringBuffer aCurrentCharacters;
ManifestStack aStack;
bool bIgnoreEncryptData;
bool bPgpEncryption;
More information about the Libreoffice-commits
mailing list