jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1209563 - in /jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json: JsopStreamTest.java JsopTest.java fast/JsopObjectTest.java
Date Fri, 02 Dec 2011 16:27:59 GMT
Author: thomasm
Date: Fri Dec  2 16:27:58 2011
New Revision: 1209563

URL: http://svn.apache.org/viewvc?rev=1209563&view=rev
Log:
Using the StopWatch tool.

Modified:
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsopStreamTest.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsopTest.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/fast/JsopObjectTest.java

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsopStreamTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsopStreamTest.java?rev=1209563&r1=1209562&r2=1209563&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsopStreamTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsopStreamTest.java
Fri Dec  2 16:27:58 2011
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.mk.json;
 
 import java.io.IOException;
+import org.apache.jackrabbit.mk.util.StopWatch;
 import junit.framework.TestCase;
 
 public class JsopStreamTest extends TestCase {
@@ -25,7 +26,7 @@ public class JsopStreamTest extends Test
     public static void main(String... args) {
         for (int k = 0; k < 5; k++) {
             String s = "Hello \"World\" Hello \"World\" Hello \"World\" Hello \"World\" Hello
\"World\" Hello \"World\" ";
-            long t = System.currentTimeMillis();
+            StopWatch timer = new StopWatch();
             JsopWriter w = k % 2 == 1 ? new JsopBuilder() : new JsopStream();
             for (int i = 0; i < 1000000; i++) {
                 w.value(s);
@@ -33,7 +34,7 @@ public class JsopStreamTest extends Test
                     w.reset();
                 }
             }
-            System.out.println(w.getClass() + ": " + (System.currentTimeMillis() - t));
+            System.out.println(w.getClass() + ": " + timer.seconds());
         }
         // JsopStream: 20
         // JsopBuilder: 1150

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsopTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsopTest.java?rev=1209563&r1=1209562&r2=1209563&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsopTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsopTest.java
Fri Dec  2 16:27:58 2011
@@ -16,9 +16,9 @@
  */
 package org.apache.jackrabbit.mk.json;
 
-import junit.framework.TestCase;
-
 import java.io.IOException;
+import junit.framework.TestCase;
+import org.apache.jackrabbit.mk.util.StopWatch;
 
 /**
  * Test the Jsop tokenizer and builder.
@@ -30,12 +30,12 @@ public class JsopTest extends TestCase {
         for (int k = 0; k < 5; k++) {
             // String s = "Hello World Hello World Hello World Hello World Hello World Hello
World ";
             String s = "Hello \"World\" Hello \"World\" Hello \"World\" Hello \"World\" Hello
\"World\" Hello \"World\" ";
-            long t = System.currentTimeMillis();
+            StopWatch timer = new StopWatch();
             int t2 = 0;
             for (int i = 0; i < 10000000; i++) {
                 t2 += JsopBuilder.encode(s).length();
             }
-            System.out.println(System.currentTimeMillis() - t);
+            System.out.println(timer.seconds());
         }
         // old: not escaped: 5691 ms; escaped: 10609 ms
         // new: not escaped: 3931 ms; escaped: 11001 ms

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/fast/JsopObjectTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/fast/JsopObjectTest.java?rev=1209563&r1=1209562&r2=1209563&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/fast/JsopObjectTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/fast/JsopObjectTest.java
Fri Dec  2 16:27:58 2011
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.mk.json.fast;
 
 import java.math.BigDecimal;
+import org.apache.jackrabbit.mk.util.StopWatch;
 import junit.framework.TestCase;
 
 /**
@@ -36,12 +37,12 @@ public class JsopObjectTest extends Test
                 w.put("child" + j, data);
             }
             String jsop = w.toString();
-            long t = System.currentTimeMillis();
+            StopWatch timer = new StopWatch();
             for (int j = 0; j < 10000; j++) {
                 JsopObject o = (JsopObject) Jsop.parse(jsop);
                 assertEquals(data, o.get("child99"));
             }
-            System.out.println((System.currentTimeMillis() - t) + " lengthIndex=" + lengthIndex);
+            System.out.println(timer.seconds() + " lengthIndex=" + lengthIndex);
         }
     }
 



Mime
View raw message