summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-11-11 08:47:08 +0100
committerLuboš Luňák <l.lunak@collabora.com>2021-11-11 13:07:52 +0100
commit871d5fe3ae531f8849908e50bf87c2848f0b9068 (patch)
tree226ea28b93843bf649206d1b38d10ddee168a5cb
parentUse o3tl::convert (diff)
downloadcore-871d5fe3ae531f8849908e50bf87c2848f0b9068.tar.gz
core-871d5fe3ae531f8849908e50bf87c2848f0b9068.zip
do not use grouped cell calculation for just a single cell
We do threaded calculations per row, so there's no point in setting up all the thread stuff effectively just for a single thread (all but one would be called to do nothing). No point in setting up OpenCL in this case either. Change-Id: I91ea5a7f219f8518a934ecbb04667fa7fba1cdff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125026 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--sc/source/core/data/formulacell.cxx21
1 files changed, 12 insertions, 9 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index d678fad353c7..409b14767a82 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -4652,15 +4652,6 @@ bool ScFormulaCell::InterpretFormulaGroup(SCROW nStartOffset, SCROW nEndOffset)
}
}
- // Guard against endless recursion of Interpret() calls, for this to work
- // ScFormulaCell::InterpretFormulaGroup() must never be called through
- // anything else than ScFormulaCell::Interpret(), same as
- // ScFormulaCell::InterpretTail()
- RecursionCounter aRecursionCounter( rRecursionHelper, this);
-
- bool bDependencyComputed = false;
- bool bDependencyCheckFailed = false;
-
// Get rid of -1's in offsets (defaults) or any invalid offsets.
SCROW nMaxOffset = mxGroup->mnLength - 1;
nStartOffset = nStartOffset < 0 ? 0 : std::min(nStartOffset, nMaxOffset);
@@ -4672,6 +4663,18 @@ bool ScFormulaCell::InterpretFormulaGroup(SCROW nStartOffset, SCROW nEndOffset)
nEndOffset = nMaxOffset;
}
+ if (nEndOffset == nStartOffset)
+ return false; // Do not use threads for a single row.
+
+ // Guard against endless recursion of Interpret() calls, for this to work
+ // ScFormulaCell::InterpretFormulaGroup() must never be called through
+ // anything else than ScFormulaCell::Interpret(), same as
+ // ScFormulaCell::InterpretTail()
+ RecursionCounter aRecursionCounter( rRecursionHelper, this);
+
+ bool bDependencyComputed = false;
+ bool bDependencyCheckFailed = false;
+
// Preference order: First try OpenCL, then threading.
// TODO: Do formula-group span computation for OCL too if nStartOffset/nEndOffset are non default.
if( InterpretFormulaGroupOpenCL(aScope, bDependencyComputed, bDependencyCheckFailed))