[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/inc sc/source
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Mon Sep 13 10:54:59 UTC 2021
sc/inc/global.hxx | 1 +
sc/source/core/data/global.cxx | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 3d190edd71ac8f5a78b683ab82e5fa23e198afbb
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Sep 9 16:34:08 2021 +0200
Commit: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Mon Sep 13 12:54:25 2021 +0200
cache FormulaError::NoRef error string (tdf#144249)
Those COUNTIF() may call it a huge number of times, and the translation
of the string each time then actually is a noticeable impact. And
ScGlobal already does one-time intialization of objects based
on the locale, so one-time initializing a string there should be fine
too.
Change-Id: I0daeb50ccb43f780d99cf3838cfd1bf790c5f6cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121856
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
(cherry picked from commit b4c1bb2f91e9ae47820c289e2c08f640a958cf05)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121984
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 50041b37b323..d66801a9e205 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -509,6 +509,7 @@ class ScGlobal
static std::unique_ptr<ScUserList> xUserList;
static SC_DLLPUBLIC const OUString aEmptyOUString;
static OUString aStrClipDocName;
+ static OUString aStrErrorStringNoRef;
static std::unique_ptr<SvxBrushItem> xEmptyBrushItem;
static std::unique_ptr<SvxBrushItem> xButtonBrushItem;
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 55415f1fdbd7..8295b8033182 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -88,6 +88,7 @@ std::atomic<::utl::TransliterationWrapper*> ScGlobal::pCaseTransliteration(nullp
css::uno::Reference< css::i18n::XOrdinalSuffix> ScGlobal::xOrdinalSuffix;
const OUString ScGlobal::aEmptyOUString;
OUString ScGlobal::aStrClipDocName;
+OUString ScGlobal::aStrErrorStringNoRef;
std::unique_ptr<SvxBrushItem> ScGlobal::xEmptyBrushItem;
std::unique_ptr<SvxBrushItem> ScGlobal::xButtonBrushItem;
@@ -304,8 +305,8 @@ OUString ScGlobal::GetErrorString(FormulaError nErr)
switch (nErr)
{
case FormulaError::NoRef:
- pErrNumber = STR_NO_REF_TABLE;
- break;
+ // tdf#144249 This may get called very extensively, so cached.
+ return aStrErrorStringNoRef;
case FormulaError::NoAddin:
pErrNumber = STR_NO_ADDIN;
break;
@@ -451,6 +452,7 @@ void ScGlobal::Init()
InitAddIns();
aStrClipDocName = ScResId( SCSTR_NONAME ) + "1";
+ aStrErrorStringNoRef = ScResId( STR_NO_REF_TABLE );
// ScDocumentPool::InitVersionMaps() has been called earlier already
}
More information about the Libreoffice-commits
mailing list