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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu May 30 11:03:52 UTC 2019


 sw/source/core/txtnode/ndtxt.cxx |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit b32a962897bd3dfeb012d971a0c3349c8d58c7fd
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed May 29 15:50:47 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu May 30 13:02:39 2019 +0200

    tdf#125372 writer, file with lots of hints very slow to open, part6
    
    Takes load time from 2m11 to 1m45
    
    Since we're only interested in hints with end <= nIdx,
    GetLastPosSortedByEnd to avoid scanning some of the list
    
    Change-Id: Ibd80cb247176419aac5b6956593e5b7807c23cbf
    Reviewed-on: https://gerrit.libreoffice.org/73194
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 4a8ee16f7503..691c20f6490b 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1615,17 +1615,17 @@ bool SwTextNode::DontExpandFormat( const SwIndex& rIdx, bool bFlag,
     if ( HasHints() )
     {
         m_pSwpHints->SortIfNeedBe();
-        const size_t nEndCnt = m_pSwpHints->Count();
-        size_t nPos = nEndCnt;
-        while( nPos )
+        int nPos = m_pSwpHints->GetLastPosSortedByEnd(nIdx);
+        for ( ; nPos >= 0; --nPos)
         {
-            SwTextAttr *pTmp = m_pSwpHints->GetSortedByEnd( --nPos );
+            SwTextAttr *pTmp = m_pSwpHints->GetSortedByEnd( nPos );
             const sal_Int32 *pEnd = pTmp->GetEnd();
-            if( !pEnd || *pEnd > nIdx )
+            if( !pEnd )
                 continue;
+            assert( *pEnd <= nIdx );
             if( nIdx != *pEnd )
-                nPos = 0;
-            else if( bFlag != pTmp->DontExpand() && !pTmp->IsLockExpandFlag()
+                break;
+            if( bFlag != pTmp->DontExpand() && !pTmp->IsLockExpandFlag()
                      && *pEnd > pTmp->GetStart())
             {
                 bRet = true;


More information about the Libreoffice-commits mailing list