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

Michael Meeks michael.meeks at collabora.com
Wed May 21 02:01:53 PDT 2014


 sc/source/core/data/document.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 7732f806dfcc9375757e7ccbe1ca3c1d194af266
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue May 20 08:13:53 2014 +0100

    ODS load perf: avoid excessive calls to uppercase to compare tab names.
    
    Change-Id: I37b9e49607c8c51f10bc8ff8fc342b02fdb8b7e1

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index d72e7db..97c10ca 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -237,7 +237,16 @@ bool ScDocument::GetCodeName( SCTAB nTab, OUString& rName ) const
 
 bool ScDocument::GetTable( const OUString& rName, SCTAB& rTab ) const
 {
-    OUString aUpperName = ScGlobal::pCharClass->uppercase(rName);
+    OUString aUpperName;
+    static OUString aCacheName, aCacheUpperName;
+
+    if (aCacheName != rName)
+    {
+        aCacheName = rName;
+        // surprisingly slow ...
+        aCacheUpperName = ScGlobal::pCharClass->uppercase(rName);
+    }
+    aUpperName = aCacheUpperName;
 
     for (SCTAB i=0; i< static_cast<SCTAB>(maTabs.size()); i++)
         if (maTabs[i])


More information about the Libreoffice-commits mailing list