sc/inc/formulacell.hxx | 30 +++++++++++++++++++++++++++--- sc/source/core/data/formulacell.cxx | 27 --------------------------- 2 files changed, 27 insertions(+), 30 deletions(-)
New commits: commit eb51a44ca493b29d4caee393cf39d09a0df97f9e Author: Dennis Francis <dennis.fran...@collabora.co.uk> AuthorDate: Thu Nov 8 10:03:44 2018 +0530 Commit: Dennis Francis <dennis.fran...@collabora.com> CommitDate: Mon Nov 12 06:14:42 2018 +0100 Make MaybeInterpret, NeedsInterpret, IsDirtyOrInTableOpDirty inline because they are in the hot path of the most common workload. For example, in SUM(A1:A50000) where column A is itself a formula-group, in threaded mode(default) A1:A50000 will already be evaluated, so cost to calling MaybeInterpret/NeedsInterpret etc should be as minimal as possible. Change-Id: Ie15c1483573391a718fb3af14cba3c798323363d Reviewed-on: https://gerrit.libreoffice.org/63064 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Jenkins diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 3af68fbbfadc..9434ed8087de 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -27,6 +27,7 @@ #include "types.hxx" #include "interpretercontext.hxx" +#include "document.hxx" #include "formulalogger.hxx" #include "formularesult.hxx" @@ -222,7 +223,12 @@ public: void SetDirtyAfterLoad(); void ResetTableOpDirtyVar(); void SetTableOpDirty(); - bool IsDirtyOrInTableOpDirty() const; + + bool IsDirtyOrInTableOpDirty() const + { + return bDirty || (bTableOpDirty && pDocument->IsInInterpreterTableOp()); + } + bool GetDirty() const { return bDirty; } void ResetDirty(); bool NeedsListening() const { return bNeedListening; } @@ -414,9 +420,27 @@ public: /** Determines whether or not the result string contains more than one paragraph */ bool IsMultilineResult(); - bool NeedsInterpret() const; + bool NeedsInterpret() const + { + if (bIsIterCell) + // Shortcut to force return of current value and not enter Interpret() + // as we're looping over all iteration cells. + return false; - void MaybeInterpret(); + if (!IsDirtyOrInTableOpDirty()) + return false; + + return (pDocument->GetAutoCalc() || (cMatrixFlag != ScMatrixMode::NONE)); + } + + void MaybeInterpret() + { + if (NeedsInterpret()) + { + assert(!pDocument->IsThreadedGroupCalcInProgress()); + Interpret(); + } + } /** * Turn a non-grouped cell into the top of a grouped cell. diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 07bf79af884b..23d518279896 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2517,11 +2517,6 @@ void ScFormulaCell::SetTableOpDirty() } } -bool ScFormulaCell::IsDirtyOrInTableOpDirty() const -{ - return bDirty || (bTableOpDirty && pDocument->IsInInterpreterTableOp()); -} - void ScFormulaCell::SetResultDouble( double n ) { aResult.SetDouble(n); @@ -2652,28 +2647,6 @@ bool ScFormulaCell::IsMultilineResult() return false; } -bool ScFormulaCell::NeedsInterpret() const -{ - if (bIsIterCell) - // Shortcut to force return of current value and not enter Interpret() - // as we're looping over all iteration cells. - return false; - - if (!IsDirtyOrInTableOpDirty()) - return false; - - return (pDocument->GetAutoCalc() || (cMatrixFlag != ScMatrixMode::NONE)); -} - -void ScFormulaCell::MaybeInterpret() -{ - if (NeedsInterpret()) - { - assert(!pDocument->IsThreadedGroupCalcInProgress()); - Interpret(); - } -} - bool ScFormulaCell::IsHyperLinkCell() const { return pCode && pCode->IsHyperLink(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits