[Libreoffice-commits] core.git: sw/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Oct 28 08:12:08 PDT 2014


 sw/source/core/unocore/unoportenum.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9b01059f6e2143c5b5b481f3d321309648fc7dd4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Oct 28 15:44:06 2014 +0100

    SwXTextPortionEnumeration ctor: avoid dynamic_cast in the common case
    
    For a document of 1000 pages and with 1000 bookmarks, this brings a
    considerable speedup on ODF export:
    
    before:
    real    3m28.187s
    after:
    real    2m51.565s
    
    Change-Id: Ic3f85c727a8ea4b5012d5c3f0a5887ff47762fb8

diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 4d74772..7f70bc5 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -153,14 +153,13 @@ namespace
             ++ppMark)
         {
             ::sw::mark::IMark* const pBkmk = ppMark->get();
-            ::sw::mark::CrossRefBookmark *const pCrossRefMark(
-                    dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk));
             bool const hasOther = pBkmk->IsExpanded();
 
             const SwPosition& rStartPos = pBkmk->GetMarkStart();
             if(rStartPos.nNode == nOwnNode)
             {
                 // #i109272#: cross reference marks: need special handling!
+                ::sw::mark::CrossRefBookmark *const pCrossRefMark(dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk));
                 sal_uInt8 const nType = (hasOther || pCrossRefMark)
                     ? BKM_TYPE_START : BKM_TYPE_START_END;
                 rBkmArr.insert(SwXBookmarkPortion_ImplSharedPtr(
@@ -174,6 +173,7 @@ namespace
             {
                 unique_ptr<SwPosition> pCrossRefEndPos;
                 const SwPosition* pEndPos = NULL;
+                ::sw::mark::CrossRefBookmark *const pCrossRefMark(dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk));
                 if(hasOther)
                 {
                     pEndPos = &rEndPos;


More information about the Libreoffice-commits mailing list