diff options
author | Dennis Francis <dennis.francis@collabora.co.uk> | 2018-11-08 10:03:44 +0530 |
---|---|---|
committer | Dennis Francis <dennis.francis@collabora.com> | 2018-11-12 06:14:42 +0100 |
commit | eb51a44ca493b29d4caee393cf39d09a0df97f9e (patch) | |
tree | 8ebd1a16d839a3a2e657e8c94a16ad5ec1c5f33f /sc/inc/formulacell.hxx | |
parent | 270e76f6eba44749743761c5575adf9f08e84675 (diff) |
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.meeks@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sc/inc/formulacell.hxx')
-rw-r--r-- | sc/inc/formulacell.hxx | 30 |
1 files changed, 27 insertions, 3 deletions
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. |