--- a/benchmarks/Rakefile Thu May 23 09:56:27 2013 +0100
+++ b/benchmarks/Rakefile Thu May 23 09:57:12 2013 +0100
@@ -1,5 +1,3 @@
-#require 'pry'
-
require 'yaml'
@@ -126,7 +124,7 @@
puts "export CLASSPATH=#{classpath()}"
ENV['CLASSPATH'] = classpath()
- [:jvm, :jvmint, :stx, :libjava, :libjavaint, :stx2libjava].each do | platform |
+ [:jvm, :jvmint, :stx, :libjava, :libjavaint, :stx2libjava, :ruby].each do | platform |
times[platform] = measure(test, passes, platform, runs)
end
@@ -164,7 +162,8 @@
if (platform == :'jvm')
command = "#{JAVA} stx.libjava.benchmarks.#{test} #{passes}"
elsif (platform == :'jvmint')
- command = "#{JAVA} -Xint stx.libjava.benchmarks.#{test} #{passes}"
+ #command = "#{JAVA} -Xint stx.libjava.benchmarks.#{test} #{passes}"
+ command = 'echo "EXECUTION TIME: N/A"'
elsif (platform == :'stx')
command = "./benchmark-runner.sh --smalltalk -b #{test} -n #{passes} 2>&1"
elsif (platform == :'libjava')
@@ -173,11 +172,14 @@
if test == 'Ackerman'
command = 'echo "EXECUTION TIME: N/A"'
else
- command = "./benchmark-runner.sh --nojit --java -b #{test} -n #{passes} 2>&1"
+ #command = "./benchmark-runner.sh --nojit --java -b #{test} -n #{passes} 2>&1"
+ command = 'echo "EXECUTION TIME: N/A"'
end
elsif (platform == :'stx2libjava')
command = "./benchmark-runner.sh --smalltalk2java -b #{test} -n #{passes} 2>&1"
- else
+ elsif (platform == :ruby)
+ command = "./#{test.downcase}.rb #{passes} 2>&1"
+ else
raise Exception.new("Unssuported platform: #{platform}")
end
@@ -211,12 +213,12 @@
file.write("\n")
file.write(Time.now.to_s)
file.write("\n")
- values = [[ "Test", "JVM", "JVM (int)", "STX-S", "STX-J", "STX-J (int)" , "STX-J2S" ]]
+ values = [[ "Test", "JVM", "JVM (int)", "STX-S", "STX-J", "STX-J (int)" , "STX-J2S", "Ruby" ]]
TESTS.each do | pair |
if (pair.size == 2)
key = pair[0]
if (results.has_key? key)
- values << [ key, results[key][:jvm], results[key][:jvmint], results[key][:stx], results[key][:libjava], results[key][:libjavaint], results[key][:stx2libjava] ]
+ values << [ key, results[key][:jvm], results[key][:jvmint], results[key][:stx], results[key][:libjava], results[key][:libjavaint], results[key][:stx2libjava], results[:key][:ruby] ]
end
end
end
@@ -244,12 +246,12 @@
def write_results_csv(file, results)
- values = [[ "Test", "JVM", "JVM (int)", "STX-S", "STX-J", "STX-J (int)" , "STX-J2S" ]]
+ values = [[ "Test", "JVM", "JVM (int)", "STX-S", "STX-J", "STX-J (int)" , "STX-J2S", "Ruby" ]]
TESTS.each do | pair |
if (pair.size == 2)
key = pair[0]
if (results.has_key? key)
- values << [ key, results[key][:jvm], results[key][:jvmint], results[key][:stx], results[key][:libjava], results[key][:libjavaint], results[key][:stx2libjava] ]
+ values << [ key, results[key][:jvm], results[key][:jvmint], results[key][:stx], results[key][:libjava], results[key][:libjavaint], results[key][:stx2libjava], results[key][:ruby] ]
end
end
end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/ackerman.rb Thu May 23 09:57:12 2013 +0100
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+require 'benchmark'
+
+class Integer
+ def ackermann(n)
+ return n + 1 if self == 0
+
+ if n == 0
+ (self - 1).ackermann(1)
+ else
+ (self - 1).ackermann(ackermann(n - 1))
+ end
+ end
+end
+
+results = Benchmark.bmbm do |bm|
+ raise "Expecting one arg - second ackermann param" if ARGV.size == 0
+ n = ARGV[0].to_i
+ bm.report { 10.times { 3.ackermann(n) } }
+end
+puts "EXECUTION TIME: #{results[0].real * 1000.0}"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/ary.rb Thu May 23 09:57:12 2013 +0100
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+require 'benchmark'
+
+def ary(x,y,n)
+ (n - 1).downto(1) do |i|
+ y[i] = y[i] + x[i]
+ end
+end
+
+results = Benchmark.bmbm do |bm|
+ raise "Expecting one arg - size of arrays" if ARGV.size == 0
+ n = ARGV[0].to_i
+ x = (0...n).to_a
+ y = Array.new(n) { 0 }
+
+ bm.report do
+ 1000.times { ary(x, y, n) }
+ end
+end
+puts "EXECUTION TIME: #{results[0].real * 1000.0}"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/groovy.rb Thu May 23 09:57:12 2013 +0100
@@ -0,0 +1,2 @@
+#!/usr/bin/env ruby
+puts "EXECUTION TIME: N/A"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/hash.rb Thu May 23 09:57:12 2013 +0100
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+require 'benchmark'
+
+def run_hash_test(n)
+ table = {}
+ count = 0
+ 1.upto(n) do |idx|
+ table[idx.to_s(16)] = idx
+ end
+
+ 1.upto(n) do |idx|
+ if table.has_key?(idx.to_s(10))
+ count = count + 1
+ end
+ end
+end
+
+results = Benchmark.bmbm do |bm|
+ raise "Expecting one arg - num of iterations" if ARGV.size == 0
+ n = ARGV[0].to_i
+ bm.report { run_hash_test(n) }
+end
+puts "EXECUTION TIME: #{results[0].real * 1000.0}"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/methodinvocation.rb Thu May 23 09:57:12 2013 +0100
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+require 'benchmark'
+
+class MethodInvocation
+ def do_smth
+ self
+ end
+end
+
+results = Benchmark.bmbm do |bm|
+ raise "Expecting one arg - num of invocations" if ARGV.size == 0
+ n = ARGV[0].to_i
+ inst = MethodInvocation.new
+
+ bm.report do
+ n.times { inst.do_smth }
+ end
+end
+puts "EXECUTION TIME: #{results[0].real * 1000.0}"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/native1.rb Thu May 23 09:57:12 2013 +0100
@@ -0,0 +1,2 @@
+#!/usr/bin/env ruby
+puts "EXECUTION TIME: N/A"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/objectarguments.rb Thu May 23 09:57:12 2013 +0100
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+puts "EXECUTION TIME: N/A"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/overloadedmethods.rb Thu May 23 09:57:12 2013 +0100
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+puts "EXECUTION TIME: N/A"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/overloadedmethods2.rb Thu May 23 09:57:12 2013 +0100
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+puts "EXECUTION TIME: N/A"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/primitivearguments.rb Thu May 23 09:57:12 2013 +0100
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+puts "EXECUTION TIME: N/A"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/saxon.rb Thu May 23 09:57:12 2013 +0100
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+puts "EXECUTION TIME: N/A"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/strcat.rb Thu May 23 09:57:12 2013 +0100
@@ -0,0 +1,13 @@
+#!/usr/bin/env ruby
+require 'benchmark'
+
+results = Benchmark.bmbm do |bm|
+ raise "Expecting one arg - num of iterations" if ARGV.size == 0
+ n = ARGV[0].to_i
+ hello = "hello\n"
+ result = ""
+ 10.times { result << hello }
+ bm.report { n.times { result << hello } }
+end
+puts "EXECUTION TIME: #{results[0].real * 1000.0}"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/wrappedarguments.rb Thu May 23 09:57:12 2013 +0100
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+puts "EXECUTION TIME: N/A"
+