Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

extended with F-Script

  • Loading branch information...
commit 44a1f74525aea0f8697bb82c727885f3a24110fc 1 parent 39359c8
@lp authored
View
18 bench.rb 100644 → 100755
@@ -1,19 +1,5 @@
#!/usr/bin/env ruby
-# require 'benchmark'
-#
-# n = 10
-# Benchmark.bm do |x|
-# x.report("ruby %d" % n) { system("./ruby_fib.rb %d" % n) }
-# x.report("macruby %d" % n) { system("./macruby_fib.rb %d" % n)}
-# x.report("macruby w/objc %d" % n) { system("./macruby_objc_fib.rb %d" % n) }
-# x.report("nu %d" % n) { system("./nu_fib.nu %d" % n) }
-# x.report("nu w/objc %d" % n) { system("./nu_objc_fib.nu %d" % n)}
-# x.report("python %d" % n) { system("./python_fib.py %d" % n) }
-# x.report("sbcl %d" % n) { system("./sbcl_fib.lisp %d" % n)}
-# x.report("objc %d" % n) { system("./objc_fib -n %d" % n) }
-# end
-
require 'bencher'
bench = Bencher.new ARGV do
@@ -32,7 +18,9 @@
["js on v8", lambda { |v,r| system("d8 js_v8_fib.js -- %d" % v) }],
["perl", lambda { |v,r| system("./perl_fib.pl %d" % v) }],
["lua", lambda { |v,r| system("./lua_fib.lua %d" % v) }],
- ["falcon", lambda { |v,r| system("./falcon_fib.fal %d" % v) }]
+ ["falcon", lambda { |v,r| system("./falcon_fib.fal %d" % v) }],
+ ["f-script", lambda { |v,r| system("./fscript_fib.fscript %d" % v) }],
+ ["f-script w/objc", lambda { |v,r| system("./fscript_fib_objc.fscript %d" % v) }]
]
end
View
4 bencher.rb
@@ -39,7 +39,7 @@ def run(*rang)
end
c.addTotal rank
c.addExectime c.time
- @results << sprintf("%25s: | %d failed | %9.3fs overall | score: %7.3f |\n", c.name, c.failed, c.time, rank)
+ @results << sprintf("%25s: | %d failed | %9.3fs overall | score: %9.3f |\n", c.name, c.failed, c.time, rank)
end
end
init_run_params
@@ -47,7 +47,7 @@ def run(*rang)
@results << "\nTotals:\n"
@cases.sort_by { |c| c.total }.each do |c|
- @results << sprintf("%25s: | %9.3f seconds overall | score: %8.3f |\n",c.name,c.exectime,c.total)
+ @results << sprintf("%25s: | %9.3f seconds overall | score: %9.3f |\n",c.name,c.exectime,c.total)
end
print @results
View
8 fscript_fib.fscript
@@ -0,0 +1,8 @@
+#! /usr/bin/fscript
+
+fib := [ :n |
+ n > 1 ifTrue:[fib return:((fib value:(n-1)) + (fib value:(n-2))).]
+ ifFalse:[fib return:n.]].
+
+0 to:((NSNumber numberWithInt:((sys args objectAtIndex:0) intValue))-1) do:[ :num |
+ sys out println:(fib value:num).].
View
6 fscript_fib_objc.fscript
@@ -0,0 +1,6 @@
+#! /usr/bin/fscript
+
+(NSBundle bundleWithPath:'./FibRunner.framework') load.
+
+0 to:((NSNumber numberWithInt:((sys args objectAtIndex:0) intValue))-1) do:[ :num |
+ sys out println:(FibRunner fib:num).].
Please sign in to comment.
Something went wrong with that request. Please try again.