summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-04-12 12:24:06 +0100
committerEike Rathke <erack@redhat.com>2024-05-06 15:10:12 +0200
commit34126d6fceb054b7ba05ceeae76e32c89fac580f (patch)
treeb75d55436e82349a80a5acf371cdff6bb385a394
parent9757290668b50827ab22597a73a4850ebf3f6521 (diff)
Related: tdf#160056 don't call GetParamCount twice
GetParamCount: 290ms -> 175ms Change-Id: Ic3a26b1e8035744dcab2da69a8ebd3b29dd2160a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166031 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit 030b655963c182693c7b657dc6aa4d2fe85c17c6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166301 Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/source/core/tool/interpr4.cxx31
1 files changed, 18 insertions, 13 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 9a483103e3f9..959b04a70e10 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4042,8 +4042,9 @@ StackVar ScInterpreter::Interpret()
(*aTokenMatrixMapIter).second->GetType() != svJumpMatrix)
{
// Path already calculated, reuse result.
- if (sp >= pCur->GetParamCount())
- nStackBase = sp - pCur->GetParamCount();
+ const sal_uInt8 nParamCount = pCur->GetParamCount();
+ if (sp >= nParamCount)
+ nStackBase = sp - nParamCount;
else
{
SAL_WARN("sc.core", "Stack anomaly with calculated path at "
@@ -4051,7 +4052,7 @@ StackVar ScInterpreter::Interpret()
<< " " << aPos.Format(
ScRefFlags::VALID | ScRefFlags::FORCE_DOC | ScRefFlags::TAB_3D, &mrDoc)
<< " eOp: " << static_cast<int>(eOp)
- << " params: " << static_cast<int>(pCur->GetParamCount())
+ << " params: " << static_cast<int>(nParamCount)
<< " nStackBase: " << nStackBase << " sp: " << sp);
nStackBase = sp;
assert(!"underflow");
@@ -4080,18 +4081,22 @@ StackVar ScInterpreter::Interpret()
eOp = ocNone; // JumpMatrix created
nStackBase = sp;
}
- else if (sp >= pCur->GetParamCount())
- nStackBase = sp - pCur->GetParamCount();
else
{
- SAL_WARN("sc.core", "Stack anomaly at " << aPos.Tab() << "," << aPos.Col() << "," << aPos.Row()
- << " " << aPos.Format(
- ScRefFlags::VALID | ScRefFlags::FORCE_DOC | ScRefFlags::TAB_3D, &mrDoc)
- << " eOp: " << static_cast<int>(eOp)
- << " params: " << static_cast<int>(pCur->GetParamCount())
- << " nStackBase: " << nStackBase << " sp: " << sp);
- nStackBase = sp;
- assert(!"underflow");
+ const sal_uInt8 nParamCount = pCur->GetParamCount();
+ if (sp >= nParamCount)
+ nStackBase = sp - nParamCount;
+ else
+ {
+ SAL_WARN("sc.core", "Stack anomaly at " << aPos.Tab() << "," << aPos.Col() << "," << aPos.Row()
+ << " " << aPos.Format(
+ ScRefFlags::VALID | ScRefFlags::FORCE_DOC | ScRefFlags::TAB_3D, &mrDoc)
+ << " eOp: " << static_cast<int>(eOp)
+ << " params: " << static_cast<int>(nParamCount)
+ << " nStackBase: " << nStackBase << " sp: " << sp);
+ nStackBase = sp;
+ assert(!"underflow");
+ }
}
}