sc/inc/formulalogger.hxx              |    7 +++++++
 sc/source/core/data/formulacell.cxx   |    7 +------
 sc/source/core/tool/formulalogger.cxx |   13 ++++++++++++-
 3 files changed, 20 insertions(+), 7 deletions(-)

New commits:
commit 9d320ec4d818f86e58a15fd46248026502b1cc94
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Mon May 8 19:21:08 2017 -0400

    Avoid adding unnecessary overhead to formula calculation.
    
    Instead, hide the overhead within the logger code which is disabled
    in the release build.
    
    Change-Id: Ie80c2a1725476d96d3e5551cf0303ecb5d73b47e
    Reviewed-on: https://gerrit.libreoffice.org/37409
    Reviewed-by: Kohei Yoshida <libreoff...@kohei.us>
    Tested-by: Kohei Yoshida <libreoff...@kohei.us>

diff --git a/sc/inc/formulalogger.hxx b/sc/inc/formulalogger.hxx
index 2675f7fc4b4c..39bad7d13bd7 100644
--- a/sc/inc/formulalogger.hxx
+++ b/sc/inc/formulalogger.hxx
@@ -110,6 +110,8 @@ public:
             const ScAddress& rCellPos, const ScAddress& rRefPos,
             const formula::FormulaToken& rToken );
 
+        void addGroupSizeThreasholdMessage( const ScFormulaCell& rCell );
+
         /**
          * Call this when the group calculation has finished successfully.
          */
@@ -165,6 +167,11 @@ public:
             (void) this; /* loplugin:staticmethods */
         }
 
+        void addGroupSizeThreasholdMessage( const ScFormulaCell& /*rCell*/ )
+        {
+            (void) this; /* loplugin:staticmethods */
+        }
+
         void setCalcComplete() { (void) this; /* loplugin:staticmethods */ }
     };
 
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index d1058fe4a7cb..04c19257ae17 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -4088,12 +4088,7 @@ bool ScFormulaCell::InterpretFormulaGroup()
     if (GetWeight() < 
ScInterpreter::GetGlobalConfig().mnOpenCLMinimumFormulaGroupSize)
     {
         mxGroup->meCalcState = sc::GroupCalcDisabled;
-        std::ostringstream os;
-        os << "group length below minimum threshold ("
-            << GetWeight()
-            << " < " << 
ScInterpreter::GetGlobalConfig().mnOpenCLMinimumFormulaGroupSize
-            << ")";
-        aScope.addMessage(OUString::createFromAscii(os.str().data()));
+        aScope.addGroupSizeThreasholdMessage(*this);
         return false;
     }
 
diff --git a/sc/source/core/tool/formulalogger.cxx 
b/sc/source/core/tool/formulalogger.cxx
index 7c70d4c730f9..ffa29ecd06a4 100644
--- a/sc/source/core/tool/formulalogger.cxx
+++ b/sc/source/core/tool/formulalogger.cxx
@@ -5,13 +5,13 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include <memory>
 #include <formulalogger.hxx>
 #include <formulacell.hxx>
 #include <tokenarray.hxx>
 #include <document.hxx>
 #include <tokenstringcontext.hxx>
 #include <address.hxx>
+#include <interpre.hxx>
 
 #include <osl/file.hxx>
 #include <o3tl/make_unique.hxx>
@@ -214,6 +214,17 @@ void FormulaLogger::GroupScope::addRefMessage(
     mpImpl->maMessages.push_back(aBuf.makeStringAndClear());
 }
 
+void FormulaLogger::GroupScope::addGroupSizeThreasholdMessage( const 
ScFormulaCell& rCell )
+{
+    OUStringBuffer aBuf;
+    aBuf.append("group length below minimum threshold (");
+    aBuf.append(rCell.GetWeight());
+    aBuf.append(" < ");
+    
aBuf.append(ScInterpreter::GetGlobalConfig().mnOpenCLMinimumFormulaGroupSize);
+    aBuf.append(")");
+    mpImpl->maMessages.push_back(aBuf.makeStringAndClear());
+}
+
 void FormulaLogger::GroupScope::setCalcComplete()
 {
     mpImpl->mbCalcComplete = true;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to