sw/inc/pagedesc.hxx | 1 + sw/source/core/doc/docdesc.cxx | 2 +- sw/source/core/unocore/unostyle.cxx | 18 +++++++++--------- writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 6 +++--- writerfilter/source/ooxml/OOXMLFastContextHandler.hxx | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-)
New commits: commit 295b97b2a654e00ac5a8e6a3545284fa583fce78 Author: Michael Meeks <michael.me...@collabora.com> Date: Fri Jun 20 13:50:32 2014 +0100 fdo#76260 - Switch from vector to std::stack. std::stack uses std::deque which is extremely expensive for this case. This change saves 43bn of 98bn cycles spent in createFastChildContext. Change-Id: I63919a9826563171f128e09d7206ac6cfdde336f diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index cc20804..b89a5cf 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -179,7 +179,7 @@ bool OOXMLFastContextHandler::prepareMceContext(Token_t nElement, const uno::Ref m_bDiscardChildren = false; aState.m_bTookChoice = m_bTookChoice; m_bTookChoice = false; - m_aSavedAlternateStates.push(aState); + m_aSavedAlternateStates.push_back(aState); } break; case OOXML_Choice: @@ -241,8 +241,8 @@ throw (uno::RuntimeException, xml::sax::SAXException, std::exception) m_bDiscardChildren = false; else if (Element == (NS_mce | OOXML_AlternateContent)) { - SavedAlternateState aState(m_aSavedAlternateStates.top()); - m_aSavedAlternateStates.pop(); + SavedAlternateState aState(m_aSavedAlternateStates.back()); + m_aSavedAlternateStates.pop_back(); m_bDiscardChildren = aState.m_bDiscardChildren; m_bTookChoice = aState.m_bTookChoice; } diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx index 053985d..88b1b80 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx @@ -290,7 +290,7 @@ private: uno::Reference< uno::XComponentContext > m_xContext; bool m_bDiscardChildren; bool m_bTookChoice; ///< Did we take the Choice or want Fallback instead? - std::stack<SavedAlternateState> m_aSavedAlternateStates; + std::vector<SavedAlternateState> m_aSavedAlternateStates; static sal_uInt32 mnInstanceCount; commit 9e5e9dd1b276043d2e9f45c01d72b2e89d8abdf2 Author: Michael Meeks <michael.me...@collabora.com> Date: Thu Jun 19 22:34:55 2014 +0100 fdo#76260 - a better approach for getting element names. Don't do lots more work than we need to to build the list of names. It appears that the [] operator does a lot of apparently un-necessary work. Change-Id: Id603fb4e717dc7130468465493edccfe51d384c7 diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index c3e94f9..5e2ba64 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -70,6 +70,7 @@ #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> +#include <comphelper/sequenceasvector.hxx> //UUUU #include <unobrushitemhelper.hxx> @@ -788,23 +789,22 @@ uno::Any SwXStyleFamily::getByName(const OUString& rName) uno::Sequence< OUString > SwXStyleFamily::getElementNames(void) throw( uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - uno::Sequence< OUString > aRet; + comphelper::SequenceAsVector< OUString > aRet; if(pBasePool) { - SfxStyleSheetIteratorPtr pIterator = pBasePool->CreateIterator(eFamily, SFXSTYLEBIT_ALL); - const sal_uInt16 nCount = pIterator->Count(); - aRet.realloc(nCount); - OUString* pArray = aRet.getArray(); + SfxStyleSheetIteratorPtr pIt = pBasePool->CreateIterator(eFamily, SFXSTYLEBIT_ALL); OUString aString; - for(sal_uInt16 i = 0; i < nCount; i++) + for (SfxStyleSheetBase* pStyle = pIt->First(); pStyle; pStyle = pIt->Next()) { - SwStyleNameMapper::FillProgName((*pIterator)[i]->GetName(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true ); - pArray[i] = aString; + SwStyleNameMapper::FillProgName(pStyle->GetName(), aString, + lcl_GetSwEnumFromSfxEnum ( eFamily ), true); + aRet.push_back(aString); } } else throw uno::RuntimeException(); - return aRet; + + return aRet.getAsConstList(); } sal_Bool SwXStyleFamily::hasByName(const OUString& rName) throw( uno::RuntimeException, std::exception ) commit 78378af1d404baf78f42930a29dbf8eae22bbe80 Author: Michael Meeks <michael.me...@collabora.com> Date: Wed Jun 18 12:56:29 2014 +0100 fdo#76260 - the wrong way to get a 10% win with an N^3 operation. Micro optimising the inner-loop is never the right way; on the other hand this is 10% of load time and is waste. Change-Id: Ie275be53e30834cbb6576b8e7580c16d2e47bf16 diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx index a15a851..58ab7a8 100644 --- a/sw/inc/pagedesc.hxx +++ b/sw/inc/pagedesc.hxx @@ -162,6 +162,7 @@ protected: public: OUString GetName() const { return aDescName; } + bool HasName( const OUString& rThisName ) { return aDescName == rThisName; } void SetName( const OUString& rNewName ) { aDescName = rNewName; } bool GetLandscape() const { return bLandscape; } diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 062fba3..bb8dd2d 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -638,7 +638,7 @@ SwPageDesc* SwDoc::FindPageDescByName( const OUString& rName, sal_uInt16* pPos ) if( pPos ) *pPos = USHRT_MAX; for( sal_uInt16 n = 0, nEnd = maPageDescs.size(); n < nEnd; ++n ) - if( maPageDescs[ n ]->GetName() == rName ) + if( maPageDescs[ n ]->HasName( rName ) ) { pRet = maPageDescs[ n ]; if( pPos ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits