avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scottca...@apache.org
Subject svn commit: r1068726 - /avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/Perf.java
Date Wed, 09 Feb 2011 01:38:01 GMT
Author: scottcarey
Date: Wed Feb  9 01:38:00 2011
New Revision: 1068726

URL: http://svn.apache.org/viewvc?rev=1068726&view=rev
Log:
AVRO-752. Java: Enhanced Performance Test Suite

Modified:
    avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/Perf.java

Modified: avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/Perf.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/Perf.java?rev=1068726&r1=1068725&r2=1068726&view=diff
==============================================================================
--- avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/Perf.java (original)
+++ avro/trunk/lang/java/avro/src/test/java/org/apache/avro/io/Perf.java Wed Feb  9 01:38:00
2011
@@ -34,14 +34,17 @@ import org.apache.avro.generic.GenericDa
 import org.apache.avro.generic.GenericDatumWriter;
 import org.apache.avro.generic.GenericRecord;
 import org.apache.avro.util.Utf8;
+import org.codehaus.jackson.JsonEncoding;
+import org.codehaus.jackson.JsonFactory;
+import org.codehaus.jackson.JsonGenerator;
 
 /**
  * Performance tests for various low level operations of
  * Avro encoding and decoding.
  */
 public class Perf {
-  private static final int COUNT = 160000; // needs to be a multiple of 4
-  private static final int CYCLES = 500;
+  private static final int COUNT = 250000; // needs to be a multiple of 4
+  private static final int CYCLES = 800;
   
   /**
    * Use a fixed value seed for random number generation
@@ -160,8 +163,8 @@ public class Perf {
         tests.add(test);
       }
     }
-    System.out.println("Executing tests: \n" + tests +
-        "\n readTests=" + readTests + " writeTests=" + writeTests + "\n");
+    System.out.println("Executing tests: \n" + tests +  "\n readTests:" +
+        readTests + "\n writeTests:" + writeTests + "\n cycles=" + CYCLES);
     
     for (int k = 0; k < tests.size(); k++) {
       Test t = tests.get(k);
@@ -180,6 +183,8 @@ public class Perf {
         throw e;
       }
     }
+    
+    printHeader();
 
     for (int k = 0; k < tests.size(); k++) {
       Test t = tests.get(k);
@@ -217,15 +222,21 @@ public class Perf {
     }
   }
   
+  private static final void printHeader() {
+    String header = String.format(
+        "%29s     time    M entries/sec   M bytes/sec  bytes/cycle",
+        "test name");
+    System.out.println(header.toString());
+  }
+  
   private static final void printResult(long s, Test t, String name) {
     s /= 1000;
     double entries = (t.cycles * (double) t.count);
     double bytes = t.cycles * (double) t.encodedSize;
     StringBuilder result = new StringBuilder();
-    result.append(String.format("%29s:  ", name));
-    result.append(String.format("%4d ms,  ", (s / 1000)));
-    result.append(String.format("%9.3f million entries/sec.  ", (entries / s)));
-    result.append(String.format("%9.3f million bytes/sec", (bytes/ s)));
+    result.append(String.format("%29s: %6d ms  ", name, (s/1000)));
+    result.append(String.format("%10.3f   %11.3f   %11d", 
+        (entries / s), (bytes/ s),  t.encodedSize));
     System.out.println(result.toString());
   }
   



Mime
View raw message