Skip to content

Commit

Permalink
Tested on Windows. Benchmark works without RsRuby on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
clbustos committed Jun 9, 2010
1 parent f1012e8 commit f9dcdd3
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions benchmark/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
require 'rubygems'
require 'rserve'
require 'rinruby'
begin
require 'rsruby'
rs=RSRuby.instance
rescue LoadError
rs=nil
end
require 'benchmark'
data_size=30000
tries=50
con=Rserve::Connection.new
rs=RSRuby.instance
R.eval("1",false)
data=data_size.times.map {rand()}
data_integer=data_size.times.map {rand(100)}
Expand All @@ -23,11 +27,11 @@
x.report("assign '1' rserve") {
con.assign("a", 1)
}

if rs
x.report("assign '1' rsruby") {
rs.assign('a',1)
}

end
x.report("assign double(#{data_size}) rinruby") {
tries.times {
R.a=data
Expand All @@ -36,10 +40,11 @@
x.report("assign double(#{data_size}) rserve") {
con.assign("a", data)
}
if rs
x.report("assign double(#{data_size}) rsruby") {
rs.assign("a", data)
}

end
x.report("void_eval rinruby") {
tries.times {
R.eval("1",false)
Expand All @@ -50,15 +55,19 @@
con.void_eval("1")
}
}
if rs
x.report("void_eval rsruby") {
tries.times {
rs.eval("1")
}
}
end
# Assign data
R.a=1
con.assign('a',1)
if rs
rs.assign('a',1)
end
x.report("get '1' rinruby") {
tries.times {
R.pull('a')
Expand All @@ -69,16 +78,19 @@
con.eval('a').to_ruby
}
}
if rs
x.report("get '1' rsruby") {
tries.times {
rs.a
}
}

end

R.a=data
con.assign('a',data)
if rs
rs.assign('a',data)
end
x.report("get double(#{data_size}) rinruby") {
tries.times {
R.pull('a')
Expand All @@ -89,10 +101,13 @@
con.eval('a').to_ruby
}
}

if rs
x.report("get double(#{data_size}) rsruby") {
tries.times {
rs.a
}
}
end

end

0 comments on commit f9dcdd3

Please sign in to comment.