sc/inc/global.hxx | 1 + sc/source/core/data/global.cxx | 6 ++++-- sc/source/core/data/table3.cxx | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-)
New commits: commit b4c1bb2f91e9ae47820c289e2c08f640a958cf05 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Thu Sep 9 16:34:08 2021 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Fri Sep 10 10:49:58 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.lu...@collabora.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 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 } commit d0316985db22efd6708dffa173eaabb430f6b9a8 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Thu Sep 9 16:18:02 2021 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Fri Sep 10 10:49:44 2021 +0200 do not intern a temporary cell error string Interning is way more work than a simple text comparison done once. Change-Id: If18c478fc62d1fb09ce2141fdb77b46a6bc46c08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121855 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 97d761f2479b..406284e17765 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2435,8 +2435,8 @@ public: if (rCell.meType == CELLTYPE_FORMULA && rCell.mpFormula->GetErrCode() != FormulaError::NONE) { // Error cell is evaluated as string (for now). - const svl::SharedString aCellStr = mrStrPool.intern(ScGlobal::GetErrorString(rCell.mpFormula->GetErrCode())); - return compareByStringComparator(rEntry, rItem, &aCellStr, nullptr); + const OUString aCellStr = ScGlobal::GetErrorString(rCell.mpFormula->GetErrCode()); + return compareByStringComparator(rEntry, rItem, nullptr, &aCellStr); } else if (rCell.meType == CELLTYPE_STRING) {