Kaydet (Commit) 306758ab authored tarafından Noel Grandin's avatar Noel Grandin

tdf#117066 Saving ODT document with ~1500 bookmarks is slow, part 5

Individually, these don't make much difference, but they add up
to a halving the time to save on my machine.

OStorageImpl is spending time iterating over its m_aChildrenVector to
find stuff by name, so just use a std::unordered_map.
Also return iterator from FindElement, so we can avoid searching the map
twice.
This was probably the biggest win.

Change-Id: I30776bad5377d14144fc7a47e86527e2cdb62a83
Reviewed-on: https://gerrit.libreoffice.org/70313
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst e610999b
......@@ -139,7 +139,7 @@ struct OStorage_Impl
return m_nModifiedListenerCount > 0 && m_pAntiImpl != nullptr;
}
SotElementVector_Impl m_aChildrenVector;
std::unordered_map<OUString, SotElement_Impl*> m_aChildrenMap;
SotElementVector_Impl m_aDeletedVector;
css::uno::Reference< css::container::XNameContainer > m_xPackageFolder;
......@@ -205,7 +205,7 @@ struct OStorage_Impl
void ReadContents();
void ReadRelInfoIfNecessary();
SotElementVector_Impl& GetChildrenVector();
bool HasChildren();
void GetStorageProperties();
css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > GetAllRelationshipsIfAny();
......@@ -229,6 +229,7 @@ struct OStorage_Impl
bool bDirect );
SotElement_Impl* FindElement( const OUString& rName );
std::unordered_map<OUString, SotElement_Impl*>::iterator FindElementIt( const OUString& rName );
SotElement_Impl* InsertStream( const OUString& aName, bool bEncr );
void InsertRawStream( const OUString& aName, const css::uno::Reference< css::io::XInputStream >& xInStream );
......@@ -242,7 +243,7 @@ struct OStorage_Impl
css::uno::Sequence< OUString > GetElementNames();
void RemoveElement( SotElement_Impl* pElement );
std::unordered_map<OUString, SotElement_Impl*>::iterator RemoveElement( std::unordered_map<OUString, SotElement_Impl*>::iterator pElement );
static void ClearElement( SotElement_Impl* pElement );
/// @throws css::embed::InvalidStorageException
......
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