[pypy-svn] r56190 - pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench

santagada at codespeak.net santagada at codespeak.net
Mon Jun 30 21:43:53 CEST 2008


Author: santagada
Date: Mon Jun 30 21:43:51 2008
New Revision: 56190

Modified:
   pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/ackermann.javascript
   pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/ary.javascript
   pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/binarytrees.javascript
   pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/fannkuch.javascript
   pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/fasta.javascript
   pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/fibo.javascript
   pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/harmonic.javascript
   pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/hash.javascript
   pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/hash2.javascript
   pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/heapsort.javascript
Log:
made the benchmark run on jspypy

Modified: pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/ackermann.javascript
==============================================================================
--- pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/ackermann.javascript	(original)
+++ pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/ackermann.javascript	Mon Jun 30 21:43:51 2008
@@ -11,5 +11,5 @@
       : ack(m - 1, ack(m, n - 1))));
 }
 
-var n = arguments[0];
+var n = 6;
 print("ack(3, " + n + "): " + ack(3, n));

Modified: pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/ary.javascript
==============================================================================
--- pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/ary.javascript	(original)
+++ pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/ary.javascript	Mon Jun 30 21:43:51 2008
@@ -6,7 +6,7 @@
 
 var i, k;
 
-var n = arguments[0];
+var n = 1;
 var x = Array(n);
 var y = Array(n);
 

Modified: pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/binarytrees.javascript
==============================================================================
--- pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/binarytrees.javascript	(original)
+++ pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/binarytrees.javascript	Mon Jun 30 21:43:51 2008
@@ -6,12 +6,12 @@
    this.left = left;
    this.right = right;
    this.item = item;
-}
+};
 
 TreeNode.prototype.itemCheck = function(){
    if (this.left==null) return this.item;
    else return this.item + this.left.itemCheck() - this.right.itemCheck();
-}
+};
 
 function bottomUpTree(item,depth){
    if (depth>0){
@@ -28,8 +28,12 @@
 
 
 var minDepth = 4;
-var n = arguments[0];
-var maxDepth = Math.max(minDepth + 2, n);
+var n = 12;
+if(minDepth+2 >= n)
+	maxDepth = minDepth+2;
+else
+	maxDepth = n;
+
 var stretchDepth = maxDepth + 1;
 
 var check = bottomUpTree(0,stretchDepth).itemCheck();

Modified: pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/fannkuch.javascript
==============================================================================
--- pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/fannkuch.javascript	(original)
+++ pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/fannkuch.javascript	Mon Jun 30 21:43:51 2008
@@ -62,5 +62,5 @@
    }
 }
 
-var n = arguments[0];
+var n = 8;
 print("Pfannkuchen(" + n + ") = " + fannkuch(n));

Modified: pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/fasta.javascript
==============================================================================
--- pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/fasta.javascript	(original)
+++ pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/fasta.javascript	Mon Jun 30 21:43:51 2008
@@ -24,14 +24,14 @@
   B:0.02, D:0.02, H:0.02, K:0.02,
   M:0.02, N:0.02, R:0.02, S:0.02,
   V:0.02, W:0.02, Y:0.02
-}
+};
 
 var HomoSap = {
   a: 0.3029549426680,
   c: 0.1979883004921,
   g: 0.1975473066391,
   t: 0.3015094502008
-}
+};
 
 function makeCumulative(table) {
   var last = null;
@@ -76,13 +76,13 @@
   }
 }
 
-var n = arguments[0]
+var n = 45000;
 
-print(">ONE Homo sapiens alu")
-fastaRepeat(2*n, ALU)
+print(">ONE Homo sapiens alu");
+fastaRepeat(2*n, ALU);
 
-print(">TWO IUB ambiguity codes")
-fastaRandom(3*n, IUB)
+print(">TWO IUB ambiguity codes");
+fastaRandom(3*n, IUB);
 
-print(">THREE Homo sapiens frequency")
-fastaRandom(5*n, HomoSap)
+print(">THREE Homo sapiens frequency");
+fastaRandom(5*n, HomoSap);

Modified: pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/fibo.javascript
==============================================================================
--- pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/fibo.javascript	(original)
+++ pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/fibo.javascript	Mon Jun 30 21:43:51 2008
@@ -9,6 +9,6 @@
     return fib(n-2) + fib(n-1);
 }
 
-var n = arguments[0];
+var n = 32;
 print(fib(n));
 

Modified: pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/harmonic.javascript
==============================================================================
--- pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/harmonic.javascript	(original)
+++ pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/harmonic.javascript	Mon Jun 30 21:43:51 2008
@@ -3,7 +3,8 @@
 //
 // contributed by Isaac Gouy 
 
-var n = arguments[0], partialSum = 0.0;
+var n = 10000000;
+var partialSum = 0.0;
 for (var d = 1; d <= n; d++) partialSum += 1.0/d;
-print(partialSum.toFixed(9));
+print(partialSum);
 

Modified: pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/hash.javascript
==============================================================================
--- pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/hash.javascript	(original)
+++ pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/hash.javascript	Mon Jun 30 21:43:51 2008
@@ -5,7 +5,7 @@
 // modified by Isaac Gouy
 
 var i, c = 0;
-var n = arguments[0];
+var n = 600000;
 
 var X = new Object();
 for (i=1; i<=n; i++) {

Modified: pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/hash2.javascript
==============================================================================
--- pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/hash2.javascript	(original)
+++ pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/hash2.javascript	Mon Jun 30 21:43:51 2008
@@ -4,7 +4,7 @@
 // contributed by David Hedbor
 // modified by Isaac Gouy
 
-var n = arguments[0];
+var n = 10;
 var hash1 = Object();
 var hash2 = Object();
 var arr = Array(10000);

Modified: pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/heapsort.javascript
==============================================================================
--- pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/heapsort.javascript	(original)
+++ pypy/branch/js-refactoring-quickhacks/pypy/lang/js/bench/heapsort.javascript	Mon Jun 30 21:43:51 2008
@@ -10,7 +10,7 @@
 
 var last = 42;
 
-function gen_random(max) { return(max * (last = (last * IA + IC) % IM) / IM); }
+function gen_random(max) { return(max * (last = (last * IA + IC) % IM) / IM); };
 
 function heapsort(n, ra) {
     var l, j, ir, i;
@@ -42,16 +42,16 @@
         }
         ra[i] = rra;
     }
-}
+};
 
 
-var n = arguments[0];
+var n = 1000;
 var ary, i;
     
 // create an array of N random floats
 ary = Array(n+1);
 for (i=1; i<=n; i++) {
   ary[i] = gen_random(1.0);
-}
+};
 heapsort(n, ary);
 print(ary[n].toFixed(10));



More information about the Pypy-commit mailing list