sc/source/core/data/conditio.cxx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
New commits: commit 13e05ec16bef58ae8bf8821ea420d0bc38b6ee32 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Sep 16 15:29:34 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Sep 17 19:52:38 2022 +0200 speed up large sheet with lots of conditions shaves 10% off view load time Change-Id: Iecb1274e35da2294f796376ebdc62eab509e5480 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140071 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit be89bc2194306c5eac0748abf09f396f7890563f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139988 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index bfd3b5cd8f99..bf78d7987b12 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -649,12 +649,15 @@ void ScConditionEntry::Interpret( const ScAddress& rPos ) // Evaluate formulas bool bDirty = false; // 1 and 2 separate? - std::unique_ptr<ScFormulaCell> pTemp1; + std::optional<ScFormulaCell> oTemp; ScFormulaCell* pEff1 = pFCell1.get(); if ( bRelRef1 ) { - pTemp1.reset(pFormula1 ? new ScFormulaCell(*mpDoc, rPos, *pFormula1) : new ScFormulaCell(*mpDoc, rPos)); - pEff1 = pTemp1.get(); + if (pFormula1) + oTemp.emplace(*mpDoc, rPos, *pFormula1); + else + oTemp.emplace(*mpDoc, rPos); + pEff1 = &*oTemp; pEff1->SetFreeFlying(true); } if ( pEff1 ) @@ -678,14 +681,16 @@ void ScConditionEntry::Interpret( const ScAddress& rPos ) } } } - pTemp1.reset(); + oTemp.reset(); - std::unique_ptr<ScFormulaCell> pTemp2; ScFormulaCell* pEff2 = pFCell2.get(); //@ 1!=2 if ( bRelRef2 ) { - pTemp2.reset(pFormula2 ? new ScFormulaCell(*mpDoc, rPos, *pFormula2) : new ScFormulaCell(*mpDoc, rPos)); - pEff2 = pTemp2.get(); + if (pFormula2) + oTemp.emplace(*mpDoc, rPos, *pFormula2); + else + oTemp.emplace(*mpDoc, rPos); + pEff2 = &*oTemp; pEff2->SetFreeFlying(true); } if ( pEff2 ) @@ -708,7 +713,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos ) } } } - pTemp2.reset(); + oTemp.reset(); // If IsRunning, the last values remain if (bDirty && !bFirstRun)