Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index


The export config page is still super slow with a11y enabled, the
attached prototype patch knocks about 5 minutes off it (in dbgutil
mode).

It's clearly a rubbish patch, statics need to become member variables
and I need to find the right place to invalidate the cache when
something gets added/removed from the list and then wrap the whole thing
with some fancy class name so it looks like it was designed rather than
grown. I probably won't get around to looking at this again until next
week so if someone wants to take this and run with it in the meantime
feel free.

C.
diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
index adb759c..f01ff64 100644
--- a/svtools/source/contnr/svtabbx.cxx
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -436,9 +436,20 @@ OUString SvTabListBox::GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const
 
 SvTreeListEntry* SvTabListBox::GetEntryOnPos( sal_uLong _nEntryPos ) const
 {
+    static sal_uLong nCachedEntryPos;
+    static sal_uLong nKnownStartIndex;
+    static sal_uLong nKnownStartPos;
+
     SvTreeListEntry* pEntry = NULL;
-    sal_uLong i, nPos = 0, nCount = GetLevelChildCount( NULL );
-    for ( i = 0; i < nCount; ++i )
+    sal_uLong i = 0, nPos = 0, nCount = GetLevelChildCount( NULL );
+
+    if (_nEntryPos >= nCachedEntryPos)
+    {
+        i = nKnownStartIndex;
+        nPos = nKnownStartPos;
+    }
+
+    while (i < nCount)
     {
         SvTreeListEntry* pParent = GetEntry(i);
         if ( nPos == _nEntryPos )
@@ -453,8 +464,12 @@ SvTreeListEntry* SvTabListBox::GetEntryOnPos( sal_uLong _nEntryPos ) const
             if ( pEntry )
                 break;
         }
+        ++i;
     }
 
+    nCachedEntryPos = _nEntryPos;
+    nKnownStartIndex = i;
+    nKnownStartPos = nPos;
     return pEntry;
 }
 

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.