[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/qa

Kohei Yoshida kohei.yoshida at gmail.com
Tue May 14 14:28:25 PDT 2013


 sc/qa/unit/ucalc.cxx |   27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

New commits:
commit e3d6d17741e3751fcfd77803699917f6ab30e644
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue May 14 17:30:11 2013 -0400

    Add perf test for removal of large array of formula cells.
    
    Change-Id: I2fdf38b23e74a9f4cad7abd9a943e8817f39474c

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index d051908..07fa33f 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -112,7 +112,8 @@ public:
     /**
      * Basic performance regression test. Pick some actions that *should* take
      * only a fraction of a second to complete, and make sure they stay that
-     * way.
+     * way. We set the threshold to 1 second for each action which should be
+     * large enough to accommodate slower machines or machines with high load.
      */
     void testPerf();
     void testCollator();
@@ -486,6 +487,30 @@ void Test::testPerf()
         CPPUNIT_FAIL(os.str().c_str());
     }
 
+    {
+        // Switch to R1C1 to make it easier to input relative references in multiple cells.
+        FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1);
+
+        // Insert formulas in B1:B100000. This shouldn't take long, but may take
+        // close to a second on a slower machine. We don't measure this yet, for
+        // now.
+        for (SCROW i = 0; i < 100000; ++i)
+            m_pDoc->SetString(ScAddress(1,i,0), "=RC[-1]");
+
+        // Now, Delete B2:B100000. This should complete in a fraction of a second
+        // (0.06 sec on my machine).
+        osl_getSystemTime(&aTimeBefore);
+        clearRange(m_pDoc, ScRange(1,1,0,1,99999,0));
+        osl_getSystemTime(&aTimeAfter);
+        diff = getTimeDiff(aTimeAfter, aTimeBefore);
+        if (diff >= 1.0)
+        {
+            std::ostringstream os;
+            os << "Removal of a large array of formula cells took " << diff << " seconds. It should be instant.";
+            CPPUNIT_FAIL(os.str().c_str());
+        }
+    }
+
     m_pDoc->DeleteTab(0);
 }
 


More information about the Libreoffice-commits mailing list