summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2018-11-08 10:03:44 +0530
committerDennis Francis <dennis.francis@collabora.com>2018-11-12 06:14:42 +0100
commiteb51a44ca493b29d4caee393cf39d09a0df97f9e (patch)
tree8ebd1a16d839a3a2e657e8c94a16ad5ec1c5f33f /sc
parent270e76f6eba44749743761c5575adf9f08e84675 (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')
-rw-r--r--sc/inc/formulacell.hxx30
-rw-r--r--sc/source/core/data/formulacell.cxx27
2 files changed, 27 insertions, 30 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.
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();