[Libreoffice-commits] .: sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Jul 20 20:31:24 PDT 2012


 sc/source/core/tool/scmatrix.cxx |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 87404d2671e78225aa91ead79ebf7191f6317a16
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Jul 20 23:31:06 2012 -0400

    It's much faster to pass value array in one go than individually.
    
    Change-Id: Iaf58915ab5c56ef5707f3a90a308c8b57cdc4fe9

diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index d0d3fce..ccf786c 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -38,6 +38,8 @@
 
 #include <math.h>
 
+#include <vector>
+
 #include <mdds/multi_type_matrix.hpp>
 #include <mdds/multi_type_vector_types.hpp>
 #include <mdds/multi_type_vector_trait.hpp>
@@ -856,9 +858,12 @@ void ScMatrixImpl::FillDouble( double fVal, SCSIZE nC1, SCSIZE nR1, SCSIZE nC2,
 {
     if (ValidColRow( nC1, nR1) && ValidColRow( nC2, nR2))
     {
-        for (SCSIZE i = nR1; i <= nR2; ++i)
-            for (SCSIZE j = nC1; j <= nC2; ++j)
-                maMat.set(i, j, fVal);
+        for (SCSIZE j = nC1; j <= nC2; ++j)
+        {
+            // Passing value array is much faster.
+            std::vector<double> aVals(nR2-nR1+1, fVal);
+            maMat.set(nR1, j, aVals.begin(), aVals.end());
+        }
     }
     else
     {


More information about the Libreoffice-commits mailing list