[Libreoffice-commits] core.git: i18npool/inc i18npool/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 28 10:49:28 UTC 2019


 i18npool/inc/defaultnumberingprovider.hxx                             |    6 +++++-
 i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx |    5 +++--
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 1ec6de1cff6a5f2c15aa85c12c6e327282ca8703
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jun 26 15:20:32 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jun 28 12:48:40 2019 +0200

    tdf#125706 Fields slow down down load, cache NativeNumberSupplierService
    
    Cache the NativeNumberSupplierService in DefaultNumberingProvider.
    
    Takes the load time from 5s to 4.5s.
    
    Change-Id: I13de1cd4db8785a1c94d40fb163bcc9b80a5c7f5
    Reviewed-on: https://gerrit.libreoffice.org/74741
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/i18npool/inc/defaultnumberingprovider.hxx b/i18npool/inc/defaultnumberingprovider.hxx
index eb9446c7098b..f01378ab075e 100644
--- a/i18npool/inc/defaultnumberingprovider.hxx
+++ b/i18npool/inc/defaultnumberingprovider.hxx
@@ -28,7 +28,10 @@
 
 namespace com::sun::star::container { class XHierarchicalNameAccess; }
 namespace com::sun::star::uno { class XComponentContext; }
-namespace i18npool { class TransliterationImpl; }
+namespace i18npool {
+    class TransliterationImpl;
+    class NativeNumberSupplierService;
+}
 
 namespace i18npool {
 
@@ -74,6 +77,7 @@ private:
     css::uno::Reference < css::uno::XComponentContext > m_xContext;
     css::uno::Reference < css::container::XHierarchicalNameAccess > xHierarchicalNameAccess;
     rtl::Reference<TransliterationImpl> translit;
+    rtl::Reference<NativeNumberSupplierService> mxNatNum;
     /// @throws css::uno::RuntimeException
     OUString makeNumberingIdentifier( sal_Int16 index );
     /// @throws css::uno::RuntimeException
diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index ce6eb1dde781..5e21a5a4dc5d 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -905,8 +905,9 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal
      }
 
      if (natNum) {
-            rtl::Reference<NativeNumberSupplierService> xNatNum(new NativeNumberSupplierService);
-            result += xNatNum->getNativeNumberStringParams(OUString::number(number), locale,
+            if (!mxNatNum)
+                mxNatNum.set(new NativeNumberSupplierService);
+            result += mxNatNum->getNativeNumberStringParams(OUString::number(number), locale,
                                                                  natNum, sNatNumParams);
      } else if (tableSize) {
             if ( number > tableSize && !bRecycleSymbol)


More information about the Libreoffice-commits mailing list