harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r521119 - in /harmony/enhanced/drlvm/trunk/src/test/microbenchmark/harmony-3243: ./ ArrayFillPerf.java
Date Thu, 22 Mar 2007 05:12:37 GMT
Author: varlax
Date: Wed Mar 21 22:12:36 2007
New Revision: 521119

URL: http://svn.apache.org/viewvc?view=rev&rev=521119
Log:
Added microbenchmark for HARMONY-3243

Added:
    harmony/enhanced/drlvm/trunk/src/test/microbenchmark/harmony-3243/
    harmony/enhanced/drlvm/trunk/src/test/microbenchmark/harmony-3243/ArrayFillPerf.java

Added: harmony/enhanced/drlvm/trunk/src/test/microbenchmark/harmony-3243/ArrayFillPerf.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/src/test/microbenchmark/harmony-3243/ArrayFillPerf.java?view=auto&rev=521119
==============================================================================
--- harmony/enhanced/drlvm/trunk/src/test/microbenchmark/harmony-3243/ArrayFillPerf.java (added)
+++ harmony/enhanced/drlvm/trunk/src/test/microbenchmark/harmony-3243/ArrayFillPerf.java Wed
Mar 21 22:12:36 2007
@@ -0,0 +1,62 @@
+import java.util.*;
+import java.io.*;
+
+class ArrayFillPerf
+{
+
+    int     rows;
+    int     cols;
+    char    screenBuf[][];
+    
+    public tp() {
+        int x, y;
+        rows = 24;
+        cols = 80;
+        screenBuf = new char[rows][];
+        for (y = 0; y < rows; y++) {
+            screenBuf[y] = new char[cols];
+            for (x = 0; x < cols; x++) {
+                screenBuf[y][x] = 'r';
+            }
+            ;
+        }
+        ;
+    }
+    
+    public void foo() {
+        int x, y;
+        for (y = 0; y < rows; y++) {
+            for (x = 0; x < cols; x++) {
+                screenBuf[y][x] = ' ';
+            }
+            ;
+        }
+        ;
+    }
+
+
+
+	public static void main(String args[])
+	{
+        tp t = new tp();
+        for (int i = 0; i < 500000; i++) {
+    	    t.foo();
+        }
+        
+        try {
+            Thread.sleep(1000);
+        } catch (Exception e) {};
+        
+        long t0 = System.currentTimeMillis();
+        
+        t = new tp();
+        for (int i = 0; i < 900000; i++) {
+    	    t.foo();
+        }
+        
+        System.out.println("time:"+(System.currentTimeMillis() - t0));
+
+        System.out.println("PASSED!");
+    }
+}
+



Mime
View raw message