Kaydet (Commit) eb51a44c authored tarafından Dennis Francis's avatar Dennis Francis Kaydeden (comit) Dennis Francis

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/63064Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
üst 270e76f6
......@@ -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.
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment