Permalink
Browse files

More benchmarks, fay now 'seems' to work. No sum or primes test though

  • Loading branch information...
spockz committed Mar 14, 2013
1 parent a4d1c15 commit 9ba31a9887d9241320adf8eaee133afe06772972
Showing with 1,776 additions and 877 deletions.
  1. +31 −15 benchmark.html
  2. +12 −1 fay.hs
  3. +684 −0 fay.js
  4. +11 −4 functions.hs
  5. +1,028 −854 ghcjs.fib30.js
  6. +10 −3 ghcjs.sum.js
View
@@ -5,6 +5,7 @@
<script src="benchmark.js"></script>
<script src="nativejs.js"></script>
<script src="uhcjs.js"></script>
+ <script src="fay.js"></script>
<script type="text/javascript">
function loadScript(url, callback)
{
@@ -23,9 +24,19 @@
head.appendChild(script);
}
+ function runFay(f) {
+ var main = new Fay();
+ var x = main[f]
+ do {
+ x = x.force()
+ }
+ while (typeof(x) != "number" )
+ return x
+ }
+
var runFib = false
- var runSum = true
+ var runSum = false
var runPrimes = false
if (runFib) {
@@ -36,11 +47,14 @@
fib.add('fib.nativeJS', function() {
fibJS(30)
})
- .add('fib.uhcJS', function() {
- fibUHCJS(30)
- })
+ // .add('fib.uhcJS', function() {
+ // fibUHCJS(30)
+ // })
.add('fib.ghcjs', function() {
- h$run(h$runio(h$mainZCMainzimain), function(r) { h$run(h$runio(h$flushStdout), function(r) {}); });
+ h$main(h$mainZCMainzimain);
+ })
+ .add('fib.fay', function() {
+ runFay('Fay$fibTest')
})
// add listeners
.on('cycle', function(event) {
@@ -60,20 +74,20 @@
loadScript("ghcjs.sum.js", function() {
var sumB = new Benchmark.Suite;
- // // add tests
+ // add tests
sumB = sumB.add('sum.ghcjs', function() {
- var h$mainZCZCMainzimain = h$static_fun(h$mainZCZCMainzimain_e);
-
h$main(h$mainZCMainzimain);
-
})
.add('sum.nativeJS', function() {
sum(numbers(1,100000))
})
// .add('sum.uhcJS', function() {
// sumUHCJS(100000)
// })
+ .add('sum.fay', function() {
+ runFay('Fay$sumTest')
+ })
// add listeners
.on('cycle', function(event) {
console.log(event.target)
@@ -95,15 +109,17 @@
// add tests
primes.add('primes.nativeJS', function() {
- // sum()
- })
- .add('primes.uhcJS', function() {
- primesUHCJS(1700)
+ return 0
})
+ // .add('primes.uhcJS', function() {
+ // primesUHCJS(1700)
+ // })
// .add('primes.ghcjs', function() {
- // h$run(h$runio(h$mainZCMainzimain), function(r) { h$run(h$runio(h$flushStdout), function(r) {}); });
+ // h$main(h$mainZCMainzimain);
// })
-
+ .add('primes.fay', function() {
+ runFay('Fay$primesTest')
+ })
// add listeners
.on('cycle', function(event) {
console.log(event.target)
View
13 fay.hs
@@ -1,5 +1,16 @@
+{-# LANGUAGE NoImplicitPrelude #-}
module Fay where
import Functions
-main = undefined
+import Prelude
+
+
+sumTest :: Int
+sumTest = sum [1..100000]
+
+primesTest :: Int
+primesTest = primes 1700
+
+fibTest :: Int
+fibTest = fib 30
Oops, something went wrong.

0 comments on commit 9ba31a9

Please sign in to comment.