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;
 }
 
_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to