sc/source/core/data/formulacell.cxx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
New commits: commit 871d5fe3ae531f8849908e50bf87c2848f0b9068 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Thu Nov 11 08:47:08 2021 +0100 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Nov 11 13:07:52 2021 +0100 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.lu...@collabora.com> 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))