summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2017-10-04 12:40:20 +0300
committerDennis Francis <dennis.francis@collabora.co.uk>2017-11-21 13:49:52 +0530
commitb8d13501fd75c8b71f0ab7a0d3f5b965738a2c2e (patch)
tree0d68731efb149bb6bc5bbd0a784deb48a4b8f3fd
parent0565d230efe0909addf3b9a57edff5d1cb114ae4 (diff)
Make threaded calculation the default (when OpenCL is not used)
Introduce a configuration setting to turn it off. For now, can also be turned off with the environment variable SC_NO_THREADED_CALCULATION, but that is probably not something we want to keep or guarantee staility of. (LO looks at way too many environment variables already.) Change-Id: I469cde259eda72cc2d630814a25f707f1210b0ab
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Calc.xcs6
-rw-r--r--sc/source/core/data/formulacell.cxx8
-rw-r--r--sc/source/core/tool/token.cxx5
3 files changed, 13 insertions, 6 deletions
diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index b1feca1825c6..72ac33b99413 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -1416,6 +1416,12 @@
<info>
<desc>Contains settings for how to calculate formulae.</desc>
</info>
+ <prop oor:name="UseThreadedCalculationForFormulaGroups" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Whether to use threaded calculation of forumula groups when applicable.</desc>
+ </info>
+ <value>true</value>
+ </prop>
<!-- Note: The default values below probably must correspond
to those assigned in setOpenCLConfigToDefault() in
sc/source/core/tool/calcconfig.cxx
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index fed52b93ddec..615fbb8056f7 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -54,6 +54,7 @@
#include <svl/intitem.hxx>
#include <o3tl/make_unique.hxx>
#include <rtl/strbuf.hxx>
+#include <officecfg/Office/Calc.hxx>
#include <formulagroup.hxx>
#include <listenercontext.hxx>
#include <types.hxx>
@@ -4322,11 +4323,10 @@ bool ScFormulaCell::InterpretFormulaGroup()
return false;
}
- static const bool bThreadingRequested = std::getenv("CPU_THREADED_CALCULATION");
+ static const bool bThreadingProhibited = std::getenv("SC_NO_THREADED_CALCULATION");
// To temporarilu use threading for sc unit tests regardless of the size of the formula group,
- // add the condition !std::getenv("LO_TESTNAME") below (with &&), and run with
- // CPU_THREADED_CALCULATION=yes
+ // add the condition !std::getenv("LO_TESTNAME") below (with &&)
if (GetWeight() < ScInterpreter::GetGlobalConfig().mnOpenCLMinimumFormulaGroupSize)
{
mxGroup->meCalcState = sc::GroupCalcDisabled;
@@ -4341,7 +4341,7 @@ bool ScFormulaCell::InterpretFormulaGroup()
return false;
}
- if (!ScCalcConfig::isOpenCLEnabled() && bThreadingRequested)
+ if (!bThreadingProhibited && !ScCalcConfig::isOpenCLEnabled() && officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::get())
{
// iterate over code in the formula ...
// ensure all input is pre-calculated -
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 0a586073c7c6..a24f41949022 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -25,6 +25,7 @@
#include <tools/mempool.hxx>
#include <osl/diagnose.h>
#include <sfx2/docfile.hxx>
+#include <officecfg/Office/Calc.hxx>
#include <token.hxx>
#include <tokenarray.hxx>
@@ -1346,11 +1347,11 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
// It's already disabled. No more checking needed.
return;
- static const bool bThreadingRequested = std::getenv("CPU_THREADED_CALCULATION");
+ static const bool bThreadingProhibited = std::getenv("SC_NO_THREADED_CALCULATION");
OpCode eOp = r.GetOpCode();
- if (!ScCalcConfig::isOpenCLEnabled() && bThreadingRequested)
+ if (!bThreadingProhibited && !ScCalcConfig::isOpenCLEnabled() && officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::get())
{
if (aThreadedCalcBlackList.count(eOp))
{