diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-09-09 16:34:08 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-09-10 10:49:58 +0200 |
commit | b4c1bb2f91e9ae47820c289e2c08f640a958cf05 (patch) | |
tree | 6d15d96abb783f4eaf3c195409f0267dcd19f7d5 /sc | |
parent | d0316985db22efd6708dffa173eaabb430f6b9a8 (diff) |
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@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/global.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/global.cxx | 6 |
2 files changed, 5 insertions, 2 deletions
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 3286794b2b88..f1e1ccf6e3f3 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -89,6 +89,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; @@ -305,8 +306,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; @@ -452,6 +453,7 @@ void ScGlobal::Init() InitAddIns(); aStrClipDocName = ScResId( SCSTR_NONAME ) + "1"; + aStrErrorStringNoRef = ScResId( STR_NO_REF_TABLE ); // ScDocumentPool::InitVersionMaps() has been called earlier already } |