sc/source/core/data/conditio.cxx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
New commits: commit 0d5752be6f2168ad8b1a81458955bf8d3d5bdffb Author: Noel Grandin <[email protected]> AuthorDate: Fri Sep 16 15:29:34 2022 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat Sep 17 08:15:23 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 <[email protected]> diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 7bf662bd5452..46e51cf9f297 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)
