diff options
Diffstat (limited to 'benchmark')
67 files changed, 1431 insertions, 1431 deletions
diff --git a/benchmark/bm_app_answer.rb b/benchmark/bm_app_answer.rb index 00f830e1dc..3cd8a8fd37 100644 --- a/benchmark/bm_app_answer.rb +++ b/benchmark/bm_app_answer.rb @@ -1,15 +1,15 @@ -def ack(m, n)
- if m == 0 then
- n + 1
- elsif n == 0 then
- ack(m - 1, 1)
- else
- ack(m - 1, ack(m, n - 1))
- end
-end
-
-def the_answer_to_life_the_universe_and_everything
- (ack(3,7).to_s.split(//).inject(0){|s,x| s+x.to_i}.to_s + "2" ).to_i
-end
-
-answer = the_answer_to_life_the_universe_and_everything
+def ack(m, n) + if m == 0 then + n + 1 + elsif n == 0 then + ack(m - 1, 1) + else + ack(m - 1, ack(m, n - 1)) + end +end + +def the_answer_to_life_the_universe_and_everything + (ack(3,7).to_s.split(//).inject(0){|s,x| s+x.to_i}.to_s + "2" ).to_i +end + +answer = the_answer_to_life_the_universe_and_everything diff --git a/benchmark/bm_app_factorial.rb b/benchmark/bm_app_factorial.rb index cfafd626a8..a5a5de0426 100644 --- a/benchmark/bm_app_factorial.rb +++ b/benchmark/bm_app_factorial.rb @@ -1,11 +1,11 @@ -def fact(n)
- if(n > 1)
- n * fact(n-1)
- else
- 1
- end
-end
-
-8.times{
- fact(5000)
+def fact(n) + if(n > 1) + n * fact(n-1) + else + 1 + end +end + +8.times{ + fact(5000) }
\ No newline at end of file diff --git a/benchmark/bm_app_fib.rb b/benchmark/bm_app_fib.rb index 65a149e5c4..34a7b2e725 100644 --- a/benchmark/bm_app_fib.rb +++ b/benchmark/bm_app_fib.rb @@ -1,10 +1,10 @@ -def fib n
- if n < 3
- 1
- else
- fib(n-1) + fib(n-2)
- end
-end
-
-fib(34)
-
+def fib n + if n < 3 + 1 + else + fib(n-1) + fib(n-2) + end +end + +fib(34) + diff --git a/benchmark/bm_app_mandelbrot.rb b/benchmark/bm_app_mandelbrot.rb index e981775ad3..a0dcf5e874 100644 --- a/benchmark/bm_app_mandelbrot.rb +++ b/benchmark/bm_app_mandelbrot.rb @@ -1,23 +1,23 @@ -require 'complex'
-
-def mandelbrot? z
- i = 0
- while i<100
- i+=1
- z = z * z
- return false if z.abs > 2
- end
- true
-end
-
-ary = []
-
-(0..100).each{|dx|
- (0..100).each{|dy|
- x = dx / 50.0
- y = dy / 50.0
- c = Complex(x, y)
- ary << c if mandelbrot?(c)
- }
-}
-
+require 'complex' + +def mandelbrot? z + i = 0 + while i<100 + i+=1 + z = z * z + return false if z.abs > 2 + end + true +end + +ary = [] + +(0..100).each{|dx| + (0..100).each{|dy| + x = dx / 50.0 + y = dy / 50.0 + c = Complex(x, y) + ary << c if mandelbrot?(c) + } +} + diff --git a/benchmark/bm_app_pentomino.rb b/benchmark/bm_app_pentomino.rb index 4aa144542a..59c63f358e 100644 --- a/benchmark/bm_app_pentomino.rb +++ b/benchmark/bm_app_pentomino.rb @@ -1,259 +1,259 @@ -#!/usr/local/bin/ruby
-# This program is contributed by Shin Nishiyama
-
-
-# modified by K.Sasada
-
-NP = 5
-ROW = 8 + NP
-COL = 8
-
-$p = []
-$b = []
-$no = 0
-
-def piece(n, a, nb)
- nb.each{|x|
- a[n] = x
- if n == NP-1
- $p << [a.sort]
- else
- nbc=nb.dup
- [-ROW, -1, 1, ROW].each{|d|
- if x+d > 0 and not a.include?(x+d) and not nbc.include?(x+d)
- nbc << x+d
- end
- }
- nbc.delete x
- piece(n+1,a[0..n],nbc)
- end
- }
-end
-
-def kikaku(a)
- a.collect {|x| x - a[0]}
-end
-def ud(a)
- kikaku(a.collect {|x| ((x+NP)%ROW)-ROW*((x+NP)/ROW) }.sort)
-end
-def rl(a)
- kikaku(a.collect {|x| ROW*((x+NP)/ROW)+ROW-((x+NP)%ROW)}.sort)
-end
-def xy(a)
- kikaku(a.collect {|x| ROW*((x+NP)%ROW) + (x+NP)/ROW }.sort)
-end
-
-def mkpieces
- piece(0,[],[0])
- $p.each do |a|
- a0 = a[0]
- a[1] = ud(a0)
- a[2] = rl(a0)
- a[3] = ud(rl(a0))
- a[4] = xy(a0)
- a[5] = ud(xy(a0))
- a[6] = rl(xy(a0))
- a[7] = ud(rl(xy(a0)))
- a.sort!
- a.uniq!
- end
- $p.uniq!.sort! {|x,y| x[0] <=> y[0] }
-end
-
-def mkboard
- (0...ROW*COL).each{|i|
- if i % ROW >= ROW-NP
- $b[i] = -2
- else
- $b[i] = -1
- end
- $b[3*ROW+3]=$b[3*ROW+4]=$b[4*ROW+3]=$b[4*ROW+4]=-2
- }
-end
-
-def pboard
- return # skip print
- print "No. #$no\n"
- (0...COL).each{|i|
- print "|"
- (0...ROW-NP).each{|j|
- x = $b[i*ROW+j]
- if x < 0
- print "..|"
- else
- printf "%2d|",x+1
- end
- }
- print "\n"
- }
- print "\n"
-end
-
-$pnum=[]
-def setpiece(a,pos)
- if a.length == $p.length then
- $no += 1
- pboard
- return
- end
- while $b[pos] != -1
- pos += 1
- end
- ($pnum - a).each do |i|
- $p[i].each do |x|
- f = 0
- x.each{|s|
- if $b[pos+s] != -1
- f=1
- break
- end
- }
- if f == 0 then
- x.each{|s|
- $b[pos+s] = i
- }
- a << i
- setpiece(a.dup, pos)
- a.pop
- x.each{|s|
- $b[pos+s] = -1
- }
- end
- end
- end
-end
-
-mkpieces
-mkboard
-$p[4] = [$p[4][0]]
-$pnum = (0...$p.length).to_a
-setpiece([],0)
-
-
-__END__
-
-# original
-
-NP = 5
-ROW = 8 + NP
-COL = 8
-
-$p = []
-$b = []
-$no = 0
-
-def piece(n,a,nb)
- for x in nb
- a[n] = x
- if n == NP-1
- $p << [a.sort]
- else
- nbc=nb.dup
- for d in [-ROW, -1, 1, ROW]
- if x+d > 0 and not a.include?(x+d) and not nbc.include?(x+d)
- nbc << x+d
- end
- end
- nbc.delete x
- piece(n+1,a[0..n],nbc)
- end
- end
-end
-
-def kikaku(a)
- a.collect {|x| x - a[0]}
-end
-def ud(a)
- kikaku(a.collect {|x| ((x+NP)%ROW)-ROW*((x+NP)/ROW) }.sort)
-end
-def rl(a)
- kikaku(a.collect {|x| ROW*((x+NP)/ROW)+ROW-((x+NP)%ROW)}.sort)
-end
-def xy(a)
- kikaku(a.collect {|x| ROW*((x+NP)%ROW) + (x+NP)/ROW }.sort)
-end
-
-def mkpieces
- piece(0,[],[0])
- $p.each do |a|
- a0 = a[0]
- a[1] = ud(a0)
- a[2] = rl(a0)
- a[3] = ud(rl(a0))
- a[4] = xy(a0)
- a[5] = ud(xy(a0))
- a[6] = rl(xy(a0))
- a[7] = ud(rl(xy(a0)))
- a.sort!
- a.uniq!
- end
- $p.uniq!.sort! {|x,y| x[0] <=> y[0] }
-end
-
-def mkboard
- for i in 0...ROW*COL
- if i % ROW >= ROW-NP
- $b[i] = -2
- else
- $b[i] = -1
- end
- $b[3*ROW+3]=$b[3*ROW+4]=$b[4*ROW+3]=$b[4*ROW+4]=-2
- end
-end
-
-def pboard
- print "No. #$no\n"
- for i in 0...COL
- print "|"
- for j in 0...ROW-NP
- x = $b[i*ROW+j]
- if x < 0
- print "..|"
- else
- printf "%2d|",x+1
- end
- end
- print "\n"
- end
- print "\n"
-end
-
-$pnum=[]
-def setpiece(a,pos)
- if a.length == $p.length then
- $no += 1
- pboard
- return
- end
- while $b[pos] != -1
- pos += 1
- end
- ($pnum - a).each do |i|
- $p[i].each do |x|
- f = 0
- for s in x do
- if $b[pos+s] != -1
- f=1
- break
- end
- end
- if f == 0 then
- for s in x do
- $b[pos+s] = i
- end
- a << i
- setpiece(a.dup, pos)
- a.pop
- for s in x do
- $b[pos+s] = -1
- end
- end
- end
- end
-end
-
-mkpieces
-mkboard
-$p[4] = [$p[4][0]]
-$pnum = (0...$p.length).to_a
-setpiece([],0)
+#!/usr/local/bin/ruby +# This program is contributed by Shin Nishiyama + + +# modified by K.Sasada + +NP = 5 +ROW = 8 + NP +COL = 8 + +$p = [] +$b = [] +$no = 0 + +def piece(n, a, nb) + nb.each{|x| + a[n] = x + if n == NP-1 + $p << [a.sort] + else + nbc=nb.dup + [-ROW, -1, 1, ROW].each{|d| + if x+d > 0 and not a.include?(x+d) and not nbc.include?(x+d) + nbc << x+d + end + } + nbc.delete x + piece(n+1,a[0..n],nbc) + end + } +end + +def kikaku(a) + a.collect {|x| x - a[0]} +end +def ud(a) + kikaku(a.collect {|x| ((x+NP)%ROW)-ROW*((x+NP)/ROW) }.sort) +end +def rl(a) + kikaku(a.collect {|x| ROW*((x+NP)/ROW)+ROW-((x+NP)%ROW)}.sort) +end +def xy(a) + kikaku(a.collect {|x| ROW*((x+NP)%ROW) + (x+NP)/ROW }.sort) +end + +def mkpieces + piece(0,[],[0]) + $p.each do |a| + a0 = a[0] + a[1] = ud(a0) + a[2] = rl(a0) + a[3] = ud(rl(a0)) + a[4] = xy(a0) + a[5] = ud(xy(a0)) + a[6] = rl(xy(a0)) + a[7] = ud(rl(xy(a0))) + a.sort! + a.uniq! + end + $p.uniq!.sort! {|x,y| x[0] <=> y[0] } +end + +def mkboard + (0...ROW*COL).each{|i| + if i % ROW >= ROW-NP + $b[i] = -2 + else + $b[i] = -1 + end + $b[3*ROW+3]=$b[3*ROW+4]=$b[4*ROW+3]=$b[4*ROW+4]=-2 + } +end + +def pboard + return # skip print + print "No. #$no\n" + (0...COL).each{|i| + print "|" + (0...ROW-NP).each{|j| + x = $b[i*ROW+j] + if x < 0 + print "..|" + else + printf "%2d|",x+1 + end + } + print "\n" + } + print "\n" +end + +$pnum=[] +def setpiece(a,pos) + if a.length == $p.length then + $no += 1 + pboard + return + end + while $b[pos] != -1 + pos += 1 + end + ($pnum - a).each do |i| + $p[i].each do |x| + f = 0 + x.each{|s| + if $b[pos+s] != -1 + f=1 + break + end + } + if f == 0 then + x.each{|s| + $b[pos+s] = i + } + a << i + setpiece(a.dup, pos) + a.pop + x.each{|s| + $b[pos+s] = -1 + } + end + end + end +end + +mkpieces +mkboard +$p[4] = [$p[4][0]] +$pnum = (0...$p.length).to_a +setpiece([],0) + + +__END__ + +# original + +NP = 5 +ROW = 8 + NP +COL = 8 + +$p = [] +$b = [] +$no = 0 + +def piece(n,a,nb) + for x in nb + a[n] = x + if n == NP-1 + $p << [a.sort] + else + nbc=nb.dup + for d in [-ROW, -1, 1, ROW] + if x+d > 0 and not a.include?(x+d) and not nbc.include?(x+d) + nbc << x+d + end + end + nbc.delete x + piece(n+1,a[0..n],nbc) + end + end +end + +def kikaku(a) + a.collect {|x| x - a[0]} +end +def ud(a) + kikaku(a.collect {|x| ((x+NP)%ROW)-ROW*((x+NP)/ROW) }.sort) +end +def rl(a) + kikaku(a.collect {|x| ROW*((x+NP)/ROW)+ROW-((x+NP)%ROW)}.sort) +end +def xy(a) + kikaku(a.collect {|x| ROW*((x+NP)%ROW) + (x+NP)/ROW }.sort) +end + +def mkpieces + piece(0,[],[0]) + $p.each do |a| + a0 = a[0] + a[1] = ud(a0) + a[2] = rl(a0) + a[3] = ud(rl(a0)) + a[4] = xy(a0) + a[5] = ud(xy(a0)) + a[6] = rl(xy(a0)) + a[7] = ud(rl(xy(a0))) + a.sort! + a.uniq! + end + $p.uniq!.sort! {|x,y| x[0] <=> y[0] } +end + +def mkboard + for i in 0...ROW*COL + if i % ROW >= ROW-NP + $b[i] = -2 + else + $b[i] = -1 + end + $b[3*ROW+3]=$b[3*ROW+4]=$b[4*ROW+3]=$b[4*ROW+4]=-2 + end +end + +def pboard + print "No. #$no\n" + for i in 0...COL + print "|" + for j in 0...ROW-NP + x = $b[i*ROW+j] + if x < 0 + print "..|" + else + printf "%2d|",x+1 + end + end + print "\n" + end + print "\n" +end + +$pnum=[] +def setpiece(a,pos) + if a.length == $p.length then + $no += 1 + pboard + return + end + while $b[pos] != -1 + pos += 1 + end + ($pnum - a).each do |i| + $p[i].each do |x| + f = 0 + for s in x do + if $b[pos+s] != -1 + f=1 + break + end + end + if f == 0 then + for s in x do + $b[pos+s] = i + end + a << i + setpiece(a.dup, pos) + a.pop + for s in x do + $b[pos+s] = -1 + end + end + end + end +end + +mkpieces +mkboard +$p[4] = [$p[4][0]] +$pnum = (0...$p.length).to_a +setpiece([],0) diff --git a/benchmark/bm_app_raise.rb b/benchmark/bm_app_raise.rb index 0e3297e62e..01d2ae3219 100644 --- a/benchmark/bm_app_raise.rb +++ b/benchmark/bm_app_raise.rb @@ -1,8 +1,8 @@ -i=0
-while i<300000
- i+=1
- begin
- raise
- rescue
- end
-end
+i=0 +while i<300000 + i+=1 + begin + raise + rescue + end +end diff --git a/benchmark/bm_app_strconcat.rb b/benchmark/bm_app_strconcat.rb index cc0e929da1..c6ef817263 100644 --- a/benchmark/bm_app_strconcat.rb +++ b/benchmark/bm_app_strconcat.rb @@ -1,5 +1,5 @@ -i=0
-while i<500000
- "#{1+1} #{1+1} #{1+1}"
- i+=1
-end
+i=0 +while i<500000 + "#{1+1} #{1+1} #{1+1}" + i+=1 +end diff --git a/benchmark/bm_app_tak.rb b/benchmark/bm_app_tak.rb index d70d5db8f8..efe5380f4e 100644 --- a/benchmark/bm_app_tak.rb +++ b/benchmark/bm_app_tak.rb @@ -1,13 +1,13 @@ -
-def tak x, y, z
- unless y < x
- z
- else
- tak( tak(x-1, y, z),
- tak(y-1, z, x),
- tak(z-1, x, y))
- end
-end
-
-tak(18, 9, 0)
-
+ +def tak x, y, z + unless y < x + z + else + tak( tak(x-1, y, z), + tak(y-1, z, x), + tak(z-1, x, y)) + end +end + +tak(18, 9, 0) + diff --git a/benchmark/bm_app_tarai.rb b/benchmark/bm_app_tarai.rb index 851f36d990..4c146f5ccf 100644 --- a/benchmark/bm_app_tarai.rb +++ b/benchmark/bm_app_tarai.rb @@ -1,10 +1,10 @@ -def tarai( x, y, z )
- if x <= y
- then y
- else tarai(tarai(x-1, y, z),
- tarai(y-1, z, x),
- tarai(z-1, x, y))
- end
-end
-
-tarai(12, 6, 0)
+def tarai( x, y, z ) + if x <= y + then y + else tarai(tarai(x-1, y, z), + tarai(y-1, z, x), + tarai(z-1, x, y)) + end +end + +tarai(12, 6, 0) diff --git a/benchmark/bm_loop_times.rb b/benchmark/bm_loop_times.rb index 6bda28d8f6..c5317b8228 100644 --- a/benchmark/bm_loop_times.rb +++ b/benchmark/bm_loop_times.rb @@ -1 +1 @@ -30000000.times{|e|}
+30000000.times{|e|} diff --git a/benchmark/bm_loop_whileloop.rb b/benchmark/bm_loop_whileloop.rb index 59b89cc519..5500af6d09 100644 --- a/benchmark/bm_loop_whileloop.rb +++ b/benchmark/bm_loop_whileloop.rb @@ -1,4 +1,4 @@ -i = 0
-while i<30000000 # benchmark loop 1
- i+=1
-end
+i = 0 +while i<30000000 # benchmark loop 1 + i+=1 +end diff --git a/benchmark/bm_loop_whileloop2.rb b/benchmark/bm_loop_whileloop2.rb index 976d4a9bad..56480f31ba 100644 --- a/benchmark/bm_loop_whileloop2.rb +++ b/benchmark/bm_loop_whileloop2.rb @@ -1,5 +1,5 @@ -i=0
-while i<6000000 # benchmark loop 2
- i+=1
-end
-
+i=0 +while i<6000000 # benchmark loop 2 + i+=1 +end + diff --git a/benchmark/bm_so_ackermann.rb b/benchmark/bm_so_ackermann.rb index fce9585825..7db5be9050 100644 --- a/benchmark/bm_so_ackermann.rb +++ b/benchmark/bm_so_ackermann.rb @@ -1,19 +1,19 @@ -#!/usr/bin/ruby
-# -*- mode: ruby -*-
-# $Id: ackermann-ruby.code,v 1.4 2004/11/13 07:40:41 bfulgham Exp $
-# http://www.bagley.org/~doug/shootout/
-
-def ack(m, n)
- if m == 0 then
- n + 1
- elsif n == 0 then
- ack(m - 1, 1)
- else
- ack(m - 1, ack(m, n - 1))
- end
-end
-
-NUM = 9
-ack(3, NUM)
-
-
+#!/usr/bin/ruby +# -*- mode: ruby -*- +# $Id: ackermann-ruby.code,v 1.4 2004/11/13 07:40:41 bfulgham Exp $ +# http://www.bagley.org/~doug/shootout/ + +def ack(m, n) + if m == 0 then + n + 1 + elsif n == 0 then + ack(m - 1, 1) + else + ack(m - 1, ack(m, n - 1)) + end +end + +NUM = 9 +ack(3, NUM) + + diff --git a/benchmark/bm_so_array.rb b/benchmark/bm_so_array.rb index a82a37cf16..2b8fce8f99 100644 --- a/benchmark/bm_so_array.rb +++ b/benchmark/bm_so_array.rb @@ -1,23 +1,23 @@ -#!/usr/bin/ruby
-# -*- mode: ruby -*-
-# $Id: ary-ruby.code,v 1.4 2004/11/13 07:41:27 bfulgham Exp $
-# http://www.bagley.org/~doug/shootout/
-# with help from Paul Brannan and Mark Hubbart
-
-n = 9000 # Integer(ARGV.shift || 1)
-
-x = Array.new(n)
-y = Array.new(n, 0)
-
-n.times{|bi|
- x[bi] = bi + 1
-}
-
-(0 .. 999).each do |e|
- (n-1).step(0,-1) do |bi|
- y[bi] += x.at(bi)
- end
-end
-# puts "#{y.first} #{y.last}"
-
-
+#!/usr/bin/ruby +# -*- mode: ruby -*- +# $Id: ary-ruby.code,v 1.4 2004/11/13 07:41:27 bfulgham Exp $ +# http://www.bagley.org/~doug/shootout/ +# with help from Paul Brannan and Mark Hubbart + +n = 9000 # Integer(ARGV.shift || 1) + +x = Array.new(n) +y = Array.new(n, 0) + +n.times{|bi| + x[bi] = bi + 1 +} + +(0 .. 999).each do |e| + (n-1).step(0,-1) do |bi| + y[bi] += x.at(bi) + end +end +# puts "#{y.first} #{y.last}" + + diff --git a/benchmark/bm_so_concatenate.rb b/benchmark/bm_so_concatenate.rb index 153efea1db..82629688b7 100644 --- a/benchmark/bm_so_concatenate.rb +++ b/benchmark/bm_so_concatenate.rb @@ -1,18 +1,18 @@ -#!/usr/bin/ruby
-# -*- mode: ruby -*-
-# $Id: strcat-ruby.code,v 1.4 2004/11/13 07:43:28 bfulgham Exp $
-# http://www.bagley.org/~doug/shootout/
-# based on code from Aristarkh A Zagorodnikov and Dat Nguyen
-
-STUFF = "hello\n"
-i=0
-while i<10
- i+=1
- hello = ''
- 400000.times do |e|
- hello << STUFF
- end
-end
-# puts hello.length
-
-
+#!/usr/bin/ruby +# -*- mode: ruby -*- +# $Id: strcat-ruby.code,v 1.4 2004/11/13 07:43:28 bfulgham Exp $ +# http://www.bagley.org/~doug/shootout/ +# based on code from Aristarkh A Zagorodnikov and Dat Nguyen + +STUFF = "hello\n" +i=0 +while i<10 + i+=1 + hello = '' + 400000.times do |e| + hello << STUFF + end +end +# puts hello.length + + diff --git a/benchmark/bm_so_count_words.rb b/benchmark/bm_so_count_words.rb index a24062d258..a208004a9a 100644 --- a/benchmark/bm_so_count_words.rb +++ b/benchmark/bm_so_count_words.rb @@ -1,18 +1,18 @@ -#!/usr/bin/ruby
-# -*- mode: ruby -*-
-# $Id: wc-ruby.code,v 1.4 2004/11/13 07:43:32 bfulgham Exp $
-# http://www.bagley.org/~doug/shootout/
-# with help from Paul Brannan
-
-input = open(File.join(File.dirname($0), 'wc.input'), 'rb')
-
-nl = nw = nc = 0
-while true
- data = (input.read(4096) or break) << (input.gets || "")
- nc += data.length
- nl += data.count("\n")
- ((data.strip! || data).tr!("\n", " ") || data).squeeze!
- #nw += data.count(" ") + 1
-end
-# STDERR.puts "#{nl} #{nw} #{nc}"
-
+#!/usr/bin/ruby +# -*- mode: ruby -*- +# $Id: wc-ruby.code,v 1.4 2004/11/13 07:43:32 bfulgham Exp $ +# http://www.bagley.org/~doug/shootout/ +# with help from Paul Brannan + +input = open(File.join(File.dirname($0), 'wc.input'), 'rb') + +nl = nw = nc = 0 +while true + data = (input.read(4096) or break) << (input.gets || "") + nc += data.length + nl += data.count("\n") + ((data.strip! || data).tr!("\n", " ") || data).squeeze! + #nw += data.count(" ") + 1 +end +# STDERR.puts "#{nl} #{nw} #{nc}" + diff --git a/benchmark/bm_so_exception.rb b/benchmark/bm_so_exception.rb index d829474750..d8b461290c 100644 --- a/benchmark/bm_so_exception.rb +++ b/benchmark/bm_so_exception.rb @@ -1,61 +1,61 @@ -#!/usr/bin/ruby
-# -*- mode: ruby -*-
-# $Id: except-ruby.code,v 1.4 2004/11/13 07:41:33 bfulgham Exp $
-# http://www.bagley.org/~doug/shootout/
-
-$HI = 0
-$LO = 0
-NUM = 250000 # Integer(ARGV[0] || 1)
-
-
-class Lo_Exception < Exception
- def initialize(num)
- @value = num
- end
-end
-
-class Hi_Exception < Exception
- def initialize(num)
- @value = num
- end
-end
-
-def some_function(num)
- begin
- hi_function(num)
- rescue
- print "We shouldn't get here, exception is: #{$!.type}\n"
- end
-end
-
-def hi_function(num)
- begin
- lo_function(num)
- rescue Hi_Exception
- $HI = $HI + 1
- end
-end
-
-def lo_function(num)
- begin
- blowup(num)
- rescue Lo_Exception
- $LO = $LO + 1
- end
-end
-
-def blowup(num)
- if num % 2 == 0
- raise Lo_Exception.new(num)
- else
- raise Hi_Exception.new(num)
- end
-end
-
-
-i = 1
-max = NUM+1
-while i < max
- i+=1
- some_function(i+1)
-end
+#!/usr/bin/ruby +# -*- mode: ruby -*- +# $Id: except-ruby.code,v 1.4 2004/11/13 07:41:33 bfulgham Exp $ +# http://www.bagley.org/~doug/shootout/ + +$HI = 0 +$LO = 0 +NUM = 250000 # Integer(ARGV[0] || 1) + + +class Lo_Exception < Exception + def initialize(num) + @value = num + end +end + +class Hi_Exception < Exception + def initialize(num) + @value = num + end +end + +def some_function(num) + begin + hi_function(num) + rescue + print "We shouldn't get here, exception is: #{$!.type}\n" + end +end + +def hi_function(num) + begin + lo_function(num) + rescue Hi_Exception + $HI = $HI + 1 + end +end + +def lo_function(num) + begin + blowup(num) + rescue Lo_Exception + $LO = $LO + 1 + end +end + +def blowup(num) + if num % 2 == 0 + raise Lo_Exception.new(num) + else + raise Hi_Exception.new(num) + end +end + + +i = 1 +max = NUM+1 +while i < max + i+=1 + some_function(i+1) +end diff --git a/benchmark/bm_so_lists.rb b/benchmark/bm_so_lists.rb index 1fcf24bbc6..3652288881 100644 --- a/benchmark/bm_so_lists.rb +++ b/benchmark/bm_so_lists.rb @@ -1,47 +1,47 @@ -#from http://www.bagley.org/~doug/shootout/bench/lists/lists.ruby
-
-NUM = 100
-SIZE = 10000
-
-def test_lists()
- # create a list of integers (Li1) from 1 to SIZE
- li1 = (1..SIZE).to_a
- # copy the list to li2 (not by individual items)
- li2 = li1.dup
- # remove each individual item from left side of li2 and
- # append to right side of li3 (preserving order)
- li3 = Array.new
- while (not li2.empty?)
- li3.push(li2.shift)
- end
- # li2 must now be empty
- # remove each individual item from right side of li3 and
- # append to right side of li2 (reversing list)
- while (not li3.empty?)
- li2.push(li3.pop)
- end
- # li3 must now be empty
- # reverse li1 in place
- li1.reverse!
- # check that first item is now SIZE
- if li1[0] != SIZE then
- p "not SIZE"
- 0
- else
- # compare li1 and li2 for equality
- if li1 != li2 then
- return(0)
- else
- # return the length of the list
- li1.length
- end
- end
-end
-
-i = 0
-while i<NUM
- i+=1
- result = test_lists()
-end
-
-result
+#from http://www.bagley.org/~doug/shootout/bench/lists/lists.ruby + +NUM = 100 +SIZE = 10000 + +def test_lists() + # create a list of integers (Li1) from 1 to SIZE + li1 = (1..SIZE).to_a + # copy the list to li2 (not by individual items) + li2 = li1.dup + # remove each individual item from left side of li2 and + # append to right side of li3 (preserving order) + li3 = Array.new + while (not li2.empty?) + li3.push(li2.shift) + end + # li2 must now be empty + # remove each individual item from right side of li3 and + # append to right side of li2 (reversing list) + while (not li3.empty?) + li2.push(li3.pop) + end + # li3 must now be empty + # reverse li1 in place + li1.reverse! + # check that first item is now SIZE + if li1[0] != SIZE then + p "not SIZE" + 0 + else + # compare li1 and li2 for equality + if li1 != li2 then + return(0) + else + # return the length of the list + li1.length + end + end +end + +i = 0 +while i<NUM + i+=1 + result = test_lists() +end + +result diff --git a/benchmark/bm_so_matrix.rb b/benchmark/bm_so_matrix.rb index 2ba22205dc..0f274ad06c 100644 --- a/benchmark/bm_so_matrix.rb +++ b/benchmark/bm_so_matrix.rb @@ -1,48 +1,48 @@ -#!/usr/bin/ruby
-# -*- mode: ruby -*-
-# $Id: matrix-ruby.code,v 1.4 2004/11/13 07:42:14 bfulgham Exp $
-# http://www.bagley.org/~doug/shootout/
-
-n = 60 #Integer(ARGV.shift || 1)
-
-size = 30
-
-def mkmatrix(rows, cols)
- count = 1
- mx = Array.new(rows)
- (0 .. (rows - 1)).each do |bi|
- row = Array.new(cols, 0)
- (0 .. (cols - 1)).each do |j|
- row[j] = count
- count += 1
- end
- mx[bi] = row
- end
- mx
-end
-
-def mmult(rows, cols, m1, m2)
- m3 = Array.new(rows)
- (0 .. (rows - 1)).each do |bi|
- row = Array.new(cols, 0)
- (0 .. (cols - 1)).each do |j|
- val = 0
- (0 .. (cols - 1)).each do |k|
- val += m1.at(bi).at(k) * m2.at(k).at(j)
- end
- row[j] = val
- end
- m3[bi] = row
- end
- m3
-end
-
-m1 = mkmatrix(size, size)
-m2 = mkmatrix(size, size)
-mm = Array.new
-n.times do
- mm = mmult(size, size, m1, m2)
-end
-# puts "#{mm[0][0]} #{mm[2][3]} #{mm[3][2]} #{mm[4][4]}"
-
-
+#!/usr/bin/ruby +# -*- mode: ruby -*- +# $Id: matrix-ruby.code,v 1.4 2004/11/13 07:42:14 bfulgham Exp $ +# http://www.bagley.org/~doug/shootout/ + +n = 60 #Integer(ARGV.shift || 1) + +size = 30 + +def mkmatrix(rows, cols) + count = 1 + mx = Array.new(rows) + (0 .. (rows - 1)).each do |bi| + row = Array.new(cols, 0) + (0 .. (cols - 1)).each do |j| + row[j] = count + count += 1 + end + mx[bi] = row + end + mx +end + +def mmult(rows, cols, m1, m2) + m3 = Array.new(rows) + (0 .. (rows - 1)).each do |bi| + row = Array.new(cols, 0) + (0 .. (cols - 1)).each do |j| + val = 0 + (0 .. (cols - 1)).each do |k| + val += m1.at(bi).at(k) * m2.at(k).at(j) + end + row[j] = val + end + m3[bi] = row + end + m3 +end + +m1 = mkmatrix(size, size) +m2 = mkmatrix(size, size) +mm = Array.new +n.times do + mm = mmult(size, size, m1, m2) +end +# puts "#{mm[0][0]} #{mm[2][3]} #{mm[3][2]} #{mm[4][4]}" + + diff --git a/benchmark/bm_so_nested_loop.rb b/benchmark/bm_so_nested_loop.rb index 4667d1b183..a0513f8c47 100644 --- a/benchmark/bm_so_nested_loop.rb +++ b/benchmark/bm_so_nested_loop.rb @@ -1,24 +1,24 @@ -#!/usr/bin/ruby
-# -*- mode: ruby -*-
-# $Id: nestedloop-ruby.code,v 1.4 2004/11/13 07:42:22 bfulgham Exp $
-# http://www.bagley.org/~doug/shootout/
-# from Avi Bryant
-
-n = 16 # Integer(ARGV.shift || 1)
-x = 0
-n.times do
- n.times do
- n.times do
- n.times do
- n.times do
- n.times do
- x += 1
- end
- end
- end
- end
- end
-end
-# puts x
-
-
+#!/usr/bin/ruby +# -*- mode: ruby -*- +# $Id: nestedloop-ruby.code,v 1.4 2004/11/13 07:42:22 bfulgham Exp $ +# http://www.bagley.org/~doug/shootout/ +# from Avi Bryant + +n = 16 # Integer(ARGV.shift || 1) +x = 0 +n.times do + n.times do + n.times do + n.times do + n.times do + n.times do + x += 1 + end + end + end + end + end +end +# puts x + + diff --git a/benchmark/bm_so_object.rb b/benchmark/bm_so_object.rb index a900177f4c..e8607c7199 100644 --- a/benchmark/bm_so_object.rb +++ b/benchmark/bm_so_object.rb @@ -1,56 +1,56 @@ -#!/usr/bin/ruby
-# -*- mode: ruby -*-
-# $Id: objinst-ruby.code,v 1.4 2004/11/13 07:42:25 bfulgham Exp $
-# http://www.bagley.org/~doug/shootout/
-# with help from Aristarkh Zagorodnikov
-
-class Toggle
- def initialize(start_state)
- @bool = start_state
- end
-
- def value
- @bool
- end
-
- def activate
- @bool = !@bool
- self
- end
-end
-
-class NthToggle < Toggle
- def initialize(start_state, max_counter)
- super start_state
- @count_max = max_counter
- @counter = 0
- end
-
- def activate
- @counter += 1
- if @counter >= @count_max
- @bool = !@bool
- @counter = 0
- end
- self
- end
-end
-
-n = 1500000 # (ARGV.shift || 1).to_i
-
-toggle = Toggle.new 1
-5.times do
- toggle.activate.value ? 'true' : 'false'
-end
-n.times do
- toggle = Toggle.new 1
-end
-
-ntoggle = NthToggle.new 1, 3
-8.times do
- ntoggle.activate.value ? 'true' : 'false'
-end
-n.times do
- ntoggle = NthToggle.new 1, 3
-end
-
+#!/usr/bin/ruby +# -*- mode: ruby -*- +# $Id: objinst-ruby.code,v 1.4 2004/11/13 07:42:25 bfulgham Exp $ +# http://www.bagley.org/~doug/shootout/ +# with help from Aristarkh Zagorodnikov + +class Toggle + def initialize(start_state) + @bool = start_state + end + + def value + @bool + end + + def activate + @bool = !@bool + self + end +end + +class NthToggle < Toggle + def initialize(start_state, max_counter) + super start_state + @count_max = max_counter + @counter = 0 + end + + def activate + @counter += 1 + if @counter >= @count_max + @bool = !@bool + @counter = 0 + end + self + end +end + +n = 1500000 # (ARGV.shift || 1).to_i + +toggle = Toggle.new 1 +5.times do + toggle.activate.value ? 'true' : 'false' +end +n.times do + toggle = Toggle.new 1 +end + +ntoggle = NthToggle.new 1, 3 +8.times do + ntoggle.activate.value ? 'true' : 'false' +end +n.times do + ntoggle = NthToggle.new 1, 3 +end + diff --git a/benchmark/bm_so_random.rb b/benchmark/bm_so_random.rb index 8bc30841a8..83c0d6d380 100644 --- a/benchmark/bm_so_random.rb +++ b/benchmark/bm_so_random.rb @@ -1,20 +1,20 @@ -# from http://www.bagley.org/~doug/shootout/bench/random/random.ruby
-
-IM = 139968.0
-IA = 3877.0
-IC = 29573.0
-
-$last = 42.0
-
-def gen_random(max)
- (max * ($last = ($last * IA + IC) % IM)) / IM
-end
-
-N = 1000000
-
-i=0
-while i<N
- i+=1
- gen_random(100.0)
-end
-# "%.9f" % gen_random(100.0)
+# from http://www.bagley.org/~doug/shootout/bench/random/random.ruby + +IM = 139968.0 +IA = 3877.0 +IC = 29573.0 + +$last = 42.0 + +def gen_random(max) + (max * ($last = ($last * IA + IC) % IM)) / IM +end + +N = 1000000 + +i=0 +while i<N + i+=1 + gen_random(100.0) +end +# "%.9f" % gen_random(100.0) diff --git a/benchmark/bm_so_sieve.rb b/benchmark/bm_so_sieve.rb index c84d5bfcb2..dbe2bfa63d 100644 --- a/benchmark/bm_so_sieve.rb +++ b/benchmark/bm_so_sieve.rb @@ -1,24 +1,24 @@ -# from http://www.bagley.org/~doug/shootout/bench/sieve/sieve.ruby
-num = 40
-count = i = j = 0
-flags0 = Array.new(8192,1)
-k = 0
-while k < num
- k+=1
- count = 0
- flags = flags0.dup
- i = 2
- while i<8192
- i+=1
- if flags[i]
- # remove all multiples of prime: i
- j = i*i
- while j < 8192
- j += i
- flags[j] = nil
- end
- count += 1
- end
- end
-end
-count
+# from http://www.bagley.org/~doug/shootout/bench/sieve/sieve.ruby +num = 40 +count = i = j = 0 +flags0 = Array.new(8192,1) +k = 0 +while k < num + k+=1 + count = 0 + flags = flags0.dup + i = 2 + while i<8192 + i+=1 + if flags[i] + # remove all multiples of prime: i + j = i*i + while j < 8192 + j += i + flags[j] = nil + end + count += 1 + end + end +end +count diff --git a/benchmark/bm_vm1_block.rb b/benchmark/bm_vm1_block.rb index 1a7f98b3ce..2dc4e72be5 100644 --- a/benchmark/bm_vm1_block.rb +++ b/benchmark/bm_vm1_block.rb @@ -1,10 +1,10 @@ -def m
- yield
-end
-
-i=0
-while i<30000000 # while loop 1
- i+=1
- m{
- }
+def m + yield +end + +i=0 +while i<30000000 # while loop 1 + i+=1 + m{ + } end
\ No newline at end of file diff --git a/benchmark/bm_vm1_const.rb b/benchmark/bm_vm1_const.rb index 0077592045..3e395d9478 100644 --- a/benchmark/bm_vm1_const.rb +++ b/benchmark/bm_vm1_const.rb @@ -1,8 +1,8 @@ -Const = 1
-
-i = 0
-while i<30000000 # while loop 1
- i+= 1
- j = Const
- k = Const
-end
+Const = 1 + +i = 0 +while i<30000000 # while loop 1 + i+= 1 + j = Const + k = Const +end diff --git a/benchmark/bm_vm1_ensure.rb b/benchmark/bm_vm1_ensure.rb index cdb4444c4c..c3b71ead5a 100644 --- a/benchmark/bm_vm1_ensure.rb +++ b/benchmark/bm_vm1_ensure.rb @@ -1,11 +1,11 @@ -i=0
-while i<30000000 # benchmark loop 1
- i+=1
- begin
- begin
- ensure
- end
- ensure
- end
-end
-
+i=0 +while i<30000000 # benchmark loop 1 + i+=1 + begin + begin + ensure + end + ensure + end +end + diff --git a/benchmark/bm_vm1_length.rb b/benchmark/bm_vm1_length.rb index 764d77bc42..2d7d7f0b52 100644 --- a/benchmark/bm_vm1_length.rb +++ b/benchmark/bm_vm1_length.rb @@ -1,9 +1,9 @@ -a = 'abc'
-b = [1, 2, 3]
-i=0
-while i<30000000 # while loop 1
- i+=1
- a.length
- b.length
-end
-
+a = 'abc' +b = [1, 2, 3] +i=0 +while i<30000000 # while loop 1 + i+=1 + a.length + b.length +end + diff --git a/benchmark/bm_vm1_rescue.rb b/benchmark/bm_vm1_rescue.rb index 2904e1a105..0c98d00e0d 100644 --- a/benchmark/bm_vm1_rescue.rb +++ b/benchmark/bm_vm1_rescue.rb @@ -1,7 +1,7 @@ -i=0
-while i<30000000 # while loop 1
- i+=1
- begin
- rescue
- end
-end
+i=0 +while i<30000000 # while loop 1 + i+=1 + begin + rescue + end +end diff --git a/benchmark/bm_vm1_simplereturn.rb b/benchmark/bm_vm1_simplereturn.rb index c0a20ba184..c843ee3d97 100644 --- a/benchmark/bm_vm1_simplereturn.rb +++ b/benchmark/bm_vm1_simplereturn.rb @@ -1,9 +1,9 @@ -def m
- return 1
-end
-i=0
-while i<30000000 # while loop 1
- i+=1
- m
-end
-
+def m + return 1 +end +i=0 +while i<30000000 # while loop 1 + i+=1 + m +end + diff --git a/benchmark/bm_vm1_swap.rb b/benchmark/bm_vm1_swap.rb index 785c999ab1..a565b6f6dc 100644 --- a/benchmark/bm_vm1_swap.rb +++ b/benchmark/bm_vm1_swap.rb @@ -1,8 +1,8 @@ -a = 1
-b = 2
-i=0
-while i<30000000 # while loop 1
- i+=1
- a, b = b, a
-end
-
+a = 1 +b = 2 +i=0 +while i<30000000 # while loop 1 + i+=1 + a, b = b, a +end + diff --git a/benchmark/bm_vm2_array.rb b/benchmark/bm_vm2_array.rb index d1a989c7e5..e29c11200f 100644 --- a/benchmark/bm_vm2_array.rb +++ b/benchmark/bm_vm2_array.rb @@ -1,5 +1,5 @@ -i=0
-while i<6000000 # benchmark loop 2
- i+=1
- a = [1,2,3,4,5,6,7,8,9,10]
-end
+i=0 +while i<6000000 # benchmark loop 2 + i+=1 + a = [1,2,3,4,5,6,7,8,9,10] +end diff --git a/benchmark/bm_vm2_method.rb b/benchmark/bm_vm2_method.rb index 4c9734f9c1..cc94b8ab3d 100644 --- a/benchmark/bm_vm2_method.rb +++ b/benchmark/bm_vm2_method.rb @@ -1,9 +1,9 @@ -def m
- nil
-end
-
-i=0
-while i<6000000 # benchmark loop 2
- i+=1
- m; m; m; m; m; m; m; m;
-end
+def m + nil +end + +i=0 +while i<6000000 # benchmark loop 2 + i+=1 + m; m; m; m; m; m; m; m; +end diff --git a/benchmark/bm_vm2_poly_method.rb b/benchmark/bm_vm2_poly_method.rb index 3341ce6912..ac9953ce5f 100644 --- a/benchmark/bm_vm2_poly_method.rb +++ b/benchmark/bm_vm2_poly_method.rb @@ -1,20 +1,20 @@ -class C1
- def m
- 1
- end
-end
-class C2
- def m
- 2
- end
-end
-
-o1 = C1.new
-o2 = C2.new
-
-i=0
-while i<6000000 # benchmark loop 2
- o = (i % 2 == 0) ? o1 : o2
- o.m; o.m; o.m; o.m; o.m; o.m; o.m; o.m
- i+=1
-end
+class C1 + def m + 1 + end +end +class C2 + def m + 2 + end +end + +o1 = C1.new +o2 = C2.new + +i=0 +while i<6000000 # benchmark loop 2 + o = (i % 2 == 0) ? o1 : o2 + o.m; o.m; o.m; o.m; o.m; o.m; o.m; o.m + i+=1 +end diff --git a/benchmark/bm_vm2_poly_method_ov.rb b/benchmark/bm_vm2_poly_method_ov.rb index b5255f8797..856ba9b161 100644 --- a/benchmark/bm_vm2_poly_method_ov.rb +++ b/benchmark/bm_vm2_poly_method_ov.rb @@ -1,20 +1,20 @@ -class C1
- def m
- 1
- end
-end
-class C2
- def m
- 2
- end
-end
-
-o1 = C1.new
-o2 = C2.new
-
-i=0
-while i<6000000 # benchmark loop 2
- o = (i % 2 == 0) ? o1 : o2
-# o.m; o.m; o.m; o.m; o.m; o.m; o.m; o.m
- i+=1
-end
+class C1 + def m + 1 + end +end +class C2 + def m + 2 + end +end + +o1 = C1.new +o2 = C2.new + +i=0 +while i<6000000 # benchmark loop 2 + o = (i % 2 == 0) ? o1 : o2 +# o.m; o.m; o.m; o.m; o.m; o.m; o.m; o.m + i+=1 +end diff --git a/benchmark/bm_vm2_proc.rb b/benchmark/bm_vm2_proc.rb index d2892386b5..0bd05b9544 100644 --- a/benchmark/bm_vm2_proc.rb +++ b/benchmark/bm_vm2_proc.rb @@ -1,14 +1,14 @@ -def m &b
- b
-end
-
-pr = m{
- a = 1
-}
-
-i=0
-while i<6000000 # benchmark loop 2
- i+=1
- pr.call
-end
-
+def m &b + b +end + +pr = m{ + a = 1 +} + +i=0 +while i<6000000 # benchmark loop 2 + i+=1 + pr.call +end + diff --git a/benchmark/bm_vm2_regexp.rb b/benchmark/bm_vm2_regexp.rb index 515cd0e531..44f6ed402e 100644 --- a/benchmark/bm_vm2_regexp.rb +++ b/benchmark/bm_vm2_regexp.rb @@ -1,6 +1,6 @@ -i=0
-str = 'xxxhogexxx'
-while i<6000000 # benchmark loop 2
- /hoge/ =~ str
- i+=1
-end
+i=0 +str = 'xxxhogexxx' +while i<6000000 # benchmark loop 2 + /hoge/ =~ str + i+=1 +end diff --git a/benchmark/bm_vm2_send.rb b/benchmark/bm_vm2_send.rb index 5b23a24dab..c20dbdd26c 100644 --- a/benchmark/bm_vm2_send.rb +++ b/benchmark/bm_vm2_send.rb @@ -1,12 +1,12 @@ -class C
- def m
- end
-end
-
-o = C.new
-
-i=0
-while i<6000000 # benchmark loop 2
- i+=1
- o.__send__ :m
-end
+class C + def m + end +end + +o = C.new + +i=0 +while i<6000000 # benchmark loop 2 + i+=1 + o.__send__ :m +end diff --git a/benchmark/bm_vm2_super.rb b/benchmark/bm_vm2_super.rb index 7511f7be87..70c86b376f 100644 --- a/benchmark/bm_vm2_super.rb +++ b/benchmark/bm_vm2_super.rb @@ -1,20 +1,20 @@ -
-class C
- def m
- 1
- end
-end
-
-class CC < C
- def m
- super()
- end
-end
-
-obj = CC.new
-
-i = 0
-while i<6000000 # benchmark loop 2
- obj.m
- i+=1
-end
+ +class C + def m + 1 + end +end + +class CC < C + def m + super() + end +end + +obj = CC.new + +i = 0 +while i<6000000 # benchmark loop 2 + obj.m + i+=1 +end diff --git a/benchmark/bm_vm2_unif1.rb b/benchmark/bm_vm2_unif1.rb index 4df6c9fa84..e12bd2ade0 100644 --- a/benchmark/bm_vm2_unif1.rb +++ b/benchmark/bm_vm2_unif1.rb @@ -1,8 +1,8 @@ -i = 0
-def m a, b
-end
-
-while i<6000000 # benchmark loop 2
- i+=1
- m 100, 200
-end
+i = 0 +def m a, b +end + +while i<6000000 # benchmark loop 2 + i+=1 + m 100, 200 +end diff --git a/benchmark/bm_vm2_zsuper.rb b/benchmark/bm_vm2_zsuper.rb index c829bb9292..3a75960403 100644 --- a/benchmark/bm_vm2_zsuper.rb +++ b/benchmark/bm_vm2_zsuper.rb @@ -1,20 +1,20 @@ -i = 0
-
-class C
- def m a
- 1
- end
-end
-
-class CC < C
- def m a
- super
- end
-end
-
-obj = CC.new
-
-while i<6000000 # benchmark loop 2
- obj.m 10
- i+=1
-end
+i = 0 + +class C + def m a + 1 + end +end + +class CC < C + def m a + super + end +end + +obj = CC.new + +while i<6000000 # benchmark loop 2 + obj.m 10 + i+=1 +end diff --git a/benchmark/bm_vm3_thread_create_join.rb b/benchmark/bm_vm3_thread_create_join.rb index a99451a58b..c459242b0e 100644 --- a/benchmark/bm_vm3_thread_create_join.rb +++ b/benchmark/bm_vm3_thread_create_join.rb @@ -1,6 +1,6 @@ -i=0
-while i<1000 # benchmark loop 3
- i+=1
- Thread.new{
- }.join
-end
+i=0 +while i<1000 # benchmark loop 3 + i+=1 + Thread.new{ + }.join +end diff --git a/benchmark/other-lang/ack.pl b/benchmark/other-lang/ack.pl index 8933c33ae5..201e22ddfa 100644 --- a/benchmark/other-lang/ack.pl +++ b/benchmark/other-lang/ack.pl @@ -1,11 +1,11 @@ -use integer;
-
-sub Ack {
- return $_[0] ? ($_[1] ? Ack($_[0]-1, Ack($_[0], $_[1]-1))
- : Ack($_[0]-1, 1))
- : $_[1]+1;
-}
-
-my $NUM = 9;
-$NUM = 1 if ($NUM < 1);
-my $ack = Ack(3, $NUM);
+use integer; + +sub Ack { + return $_[0] ? ($_[1] ? Ack($_[0]-1, Ack($_[0], $_[1]-1)) + : Ack($_[0]-1, 1)) + : $_[1]+1; +} + +my $NUM = 9; +$NUM = 1 if ($NUM < 1); +my $ack = Ack(3, $NUM); diff --git a/benchmark/other-lang/ack.py b/benchmark/other-lang/ack.py index 971796f689..9968e7cfcf 100644 --- a/benchmark/other-lang/ack.py +++ b/benchmark/other-lang/ack.py @@ -1,16 +1,16 @@ -import sys
-sys.setrecursionlimit(5000000)
-
-def Ack(M, N):
- if (not M):
- return( N + 1 )
- if (not N):
- return( Ack(M-1, 1) )
- return( Ack(M-1, Ack(M, N-1)) )
-
-def main():
- NUM = 9
- sys.setrecursionlimit(10000)
- Ack(3, NUM)
-
-main()
+import sys +sys.setrecursionlimit(5000000) + +def Ack(M, N): + if (not M): + return( N + 1 ) + if (not N): + return( Ack(M-1, 1) ) + return( Ack(M-1, Ack(M, N-1)) ) + +def main(): + NUM = 9 + sys.setrecursionlimit(10000) + Ack(3, NUM) + +main() diff --git a/benchmark/other-lang/ack.rb b/benchmark/other-lang/ack.rb index 7886183ff0..7451bed6c4 100644 --- a/benchmark/other-lang/ack.rb +++ b/benchmark/other-lang/ack.rb @@ -1,12 +1,12 @@ -def ack(m, n)
- if m == 0 then
- n + 1
- elsif n == 0 then
- ack(m - 1, 1)
- else
- ack(m - 1, ack(m, n - 1))
- end
-end
-
-NUM = 9
-ack(3, NUM)
+def ack(m, n) + if m == 0 then + n + 1 + elsif n == 0 then + ack(m - 1, 1) + else + ack(m - 1, ack(m, n - 1)) + end +end + +NUM = 9 +ack(3, NUM) diff --git a/benchmark/other-lang/ack.scm b/benchmark/other-lang/ack.scm index e9e1886933..a80b73ba55 100644 --- a/benchmark/other-lang/ack.scm +++ b/benchmark/other-lang/ack.scm @@ -1,7 +1,7 @@ -(define (ack m n)
- (cond ((zero? m) (+ n 1))
- ((zero? n) (ack (- m 1) 1))
- (else (ack (- m 1) (ack m (- n 1))))))
-
-(ack 3 9)
-
+(define (ack m n) + (cond ((zero? m) (+ n 1)) + ((zero? n) (ack (- m 1) 1)) + (else (ack (- m 1) (ack m (- n 1)))))) + +(ack 3 9) + diff --git a/benchmark/other-lang/eval.rb b/benchmark/other-lang/eval.rb index e6ff94d294..3875927389 100644 --- a/benchmark/other-lang/eval.rb +++ b/benchmark/other-lang/eval.rb @@ -1,66 +1,66 @@ -
-Bench = %w(
- loop
- ack
- fib
- tak
- fact
-)
-
-Lang = <<EOP.map{|l| l.strip}
- ruby-cyg
- ../../../test6/miniruby
- perl
- python
- gosh
-EOP
-
-Bench.replace ['loop2']
-Lang.replace ['ruby-cyg']
-
-Ext = %w(
- .rb
- .rb
- .pl
- .py
- .scm
-)
-
-p Bench
-p Lang
-
-require 'benchmark'
-
-def bench cmd
- m = Benchmark.measure{
- #p cmd
- system(cmd)
- }
- [m.utime, m.real]
-end
-
-Result = []
-Bench.each{|b|
- r = []
- Lang.each_with_index{|l, idx|
- cmd = "#{l} #{b}#{Ext[idx]}"
- r << bench(cmd)
- }
- Result << r
-}
-
-require 'pp'
-# utime
-puts Lang.join("\t")
-Bench.each_with_index{|b, bi|
- print b, "\t"
- puts Result[bi].map{|e| e[0]}.join("\t")
-}
-
-# rtime
-puts Lang.join("\t")
-Bench.each_with_index{|b, bi|
- print b, "\t"
- puts Result[bi].map{|e| e[1]}.join("\t")
-}
-
+ +Bench = %w( + loop + ack + fib + tak + fact +) + +Lang = <<EOP.map{|l| l.strip} + ruby-cyg + ../../../test6/miniruby + perl + python + gosh +EOP + +Bench.replace ['loop2'] +Lang.replace ['ruby-cyg'] + +Ext = %w( + .rb + .rb + .pl + .py + .scm +) + +p Bench +p Lang + +require 'benchmark' + +def bench cmd + m = Benchmark.measure{ + #p cmd + system(cmd) + } + [m.utime, m.real] +end + +Result = [] +Bench.each{|b| + r = [] + Lang.each_with_index{|l, idx| + cmd = "#{l} #{b}#{Ext[idx]}" + r << bench(cmd) + } + Result << r +} + +require 'pp' +# utime +puts Lang.join("\t") +Bench.each_with_index{|b, bi| + print b, "\t" + puts Result[bi].map{|e| e[0]}.join("\t") +} + +# rtime +puts Lang.join("\t") +Bench.each_with_index{|b, bi| + print b, "\t" + puts Result[bi].map{|e| e[1]}.join("\t") +} + diff --git a/benchmark/other-lang/fact.pl b/benchmark/other-lang/fact.pl index 2cef18534c..a9b0b69cdf 100644 --- a/benchmark/other-lang/fact.pl +++ b/benchmark/other-lang/fact.pl @@ -1,13 +1,13 @@ -sub fact{
- my $n = @_[0];
- if($n < 2){
- return 1;
- }
- else{
- return $n * fact($n-1);
- }
-}
-
-for($i=0; $i<10000; $i++){
- &fact(100);
-}
+sub fact{ + my $n = @_[0]; + if($n < 2){ + return 1; + } + else{ + return $n * fact($n-1); + } +} + +for($i=0; $i<10000; $i++){ + &fact(100); +} diff --git a/benchmark/other-lang/fact.py b/benchmark/other-lang/fact.py index 460e4057f4..01593965d9 100644 --- a/benchmark/other-lang/fact.py +++ b/benchmark/other-lang/fact.py @@ -1,18 +1,18 @@ -#import sys
-#sys.setrecursionlimit(1000)
-
-def factL(n):
- r = 1
- for x in range(2, n):
- r *= x
- return r
-
-def factR(n):
- if n < 2:
- return 1
- else:
- return n * factR(n-1)
-
-for i in range(10000):
- factR(100)
-
+#import sys +#sys.setrecursionlimit(1000) + +def factL(n): + r = 1 + for x in range(2, n): + r *= x + return r + +def factR(n): + if n < 2: + return 1 + else: + return n * factR(n-1) + +for i in range(10000): + factR(100) + diff --git a/benchmark/other-lang/fact.rb b/benchmark/other-lang/fact.rb index c75320824c..7e97b22b39 100644 --- a/benchmark/other-lang/fact.rb +++ b/benchmark/other-lang/fact.rb @@ -1,13 +1,13 @@ -def fact(n)
- if n < 2
- 1
- else
- n * fact(n-1)
- end
-end
-
-i=0
-while i<10000
- i+=1
- fact(100)
-end
+def fact(n) + if n < 2 + 1 + else + n * fact(n-1) + end +end + +i=0 +while i<10000 + i+=1 + fact(100) +end diff --git a/benchmark/other-lang/fact.scm b/benchmark/other-lang/fact.scm index 511990f797..c98a7fedd3 100644 --- a/benchmark/other-lang/fact.scm +++ b/benchmark/other-lang/fact.scm @@ -1,8 +1,8 @@ -(define (fact n)
- (if (< n 2)
- 1
- (* n (fact (- n 1)))))
-
-(dotimes (i 10000)
- (fact 100))
-
+(define (fact n) + (if (< n 2) + 1 + (* n (fact (- n 1))))) + +(dotimes (i 10000) + (fact 100)) + diff --git a/benchmark/other-lang/fib.pl b/benchmark/other-lang/fib.pl index d660a2337b..a46f666d1e 100644 --- a/benchmark/other-lang/fib.pl +++ b/benchmark/other-lang/fib.pl @@ -1,11 +1,11 @@ -sub fib{
- my $n = $_[0];
- if($n < 3){
- return 1;
- }
- else{
- return fib($n-1) + fib($n-2);
- }
-};
-
-&fib(34);
+sub fib{ + my $n = $_[0]; + if($n < 3){ + return 1; + } + else{ + return fib($n-1) + fib($n-2); + } +}; + +&fib(34); diff --git a/benchmark/other-lang/fib.py b/benchmark/other-lang/fib.py index 40f87f3e9c..45f2bceb8d 100644 --- a/benchmark/other-lang/fib.py +++ b/benchmark/other-lang/fib.py @@ -1,7 +1,7 @@ -def fib(n):
- if n < 3:
- return 1
- else:
- return fib(n-1) + fib(n-2)
-
-fib(34)
+def fib(n): + if n < 3: + return 1 + else: + return fib(n-1) + fib(n-2) + +fib(34) diff --git a/benchmark/other-lang/fib.rb b/benchmark/other-lang/fib.rb index 7e0e8daa7e..ec587eabe0 100644 --- a/benchmark/other-lang/fib.rb +++ b/benchmark/other-lang/fib.rb @@ -1,9 +1,9 @@ -def fib n
- if n < 3
- 1
- else
- fib(n-1) + fib(n-2)
- end
-end
-
-fib(34)
+def fib n + if n < 3 + 1 + else + fib(n-1) + fib(n-2) + end +end + +fib(34) diff --git a/benchmark/other-lang/fib.scm b/benchmark/other-lang/fib.scm index ea63503b11..2fc4e225bd 100644 --- a/benchmark/other-lang/fib.scm +++ b/benchmark/other-lang/fib.scm @@ -1,7 +1,7 @@ -(define (fib n)
- (if (< n 3)
- 1
- (+ (fib (- n 1)) (fib (- n 2)))))
-
-(fib 34)
-
+(define (fib n) + (if (< n 3) + 1 + (+ (fib (- n 1)) (fib (- n 2))))) + +(fib 34) + diff --git a/benchmark/other-lang/loop.pl b/benchmark/other-lang/loop.pl index ecacef4477..2777490aaa 100644 --- a/benchmark/other-lang/loop.pl +++ b/benchmark/other-lang/loop.pl @@ -1,3 +1,3 @@ -for($i=0; $i<30000000; $i++){
-}
-
+for($i=0; $i<30000000; $i++){ +} + diff --git a/benchmark/other-lang/loop.py b/benchmark/other-lang/loop.py index b47089fd39..003749bf3a 100644 --- a/benchmark/other-lang/loop.py +++ b/benchmark/other-lang/loop.py @@ -1,2 +1,2 @@ -for i in xrange(30000000):
- pass
+for i in xrange(30000000): + pass diff --git a/benchmark/other-lang/loop.rb b/benchmark/other-lang/loop.rb index 35cd67a7a3..d43cef61f3 100644 --- a/benchmark/other-lang/loop.rb +++ b/benchmark/other-lang/loop.rb @@ -1,4 +1,4 @@ -i=0
-while i<30000000
- i+=1
-end
+i=0 +while i<30000000 + i+=1 +end diff --git a/benchmark/other-lang/loop.scm b/benchmark/other-lang/loop.scm index 1646ac3c1d..3364f7e679 100644 --- a/benchmark/other-lang/loop.scm +++ b/benchmark/other-lang/loop.scm @@ -1 +1 @@ -(dotimes (x 30000000))
+(dotimes (x 30000000)) diff --git a/benchmark/other-lang/loop2.rb b/benchmark/other-lang/loop2.rb index f3085926a3..df8fffc1ff 100644 --- a/benchmark/other-lang/loop2.rb +++ b/benchmark/other-lang/loop2.rb @@ -1 +1 @@ -30000000.times{}
+30000000.times{} diff --git a/benchmark/other-lang/tak.pl b/benchmark/other-lang/tak.pl index c7bb626e61..7e748a67c6 100644 --- a/benchmark/other-lang/tak.pl +++ b/benchmark/other-lang/tak.pl @@ -1,11 +1,11 @@ -sub tak {
- local($x, $y, $z) = @_;
- if (!($y < $x)) {
- return $z;
- } else {
- return &tak(&tak($x - 1, $y, $z),
- &tak($y - 1, $z, $x),
- &tak($z - 1, $x, $y));
- }
-}
-&tak(18, 9, 0);
+sub tak { + local($x, $y, $z) = @_; + if (!($y < $x)) { + return $z; + } else { + return &tak(&tak($x - 1, $y, $z), + &tak($y - 1, $z, $x), + &tak($z - 1, $x, $y)); + } +} +&tak(18, 9, 0); diff --git a/benchmark/other-lang/tak.py b/benchmark/other-lang/tak.py index 9b7bd8f23c..04f3f6829c 100644 --- a/benchmark/other-lang/tak.py +++ b/benchmark/other-lang/tak.py @@ -1,8 +1,8 @@ -def tak(x, y, z):
- if not(y<x):
- return z
- else:
- return tak(tak(x-1, y, z),
- tak(y-1, z, x),
- tak(z-1, x, y))
-tak(18, 9, 0)
+def tak(x, y, z): + if not(y<x): + return z + else: + return tak(tak(x-1, y, z), + tak(y-1, z, x), + tak(z-1, x, y)) +tak(18, 9, 0) diff --git a/benchmark/other-lang/tak.rb b/benchmark/other-lang/tak.rb index d70d5db8f8..efe5380f4e 100644 --- a/benchmark/other-lang/tak.rb +++ b/benchmark/other-lang/tak.rb @@ -1,13 +1,13 @@ -
-def tak x, y, z
- unless y < x
- z
- else
- tak( tak(x-1, y, z),
- tak(y-1, z, x),
- tak(z-1, x, y))
- end
-end
-
-tak(18, 9, 0)
-
+ +def tak x, y, z + unless y < x + z + else + tak( tak(x-1, y, z), + tak(y-1, z, x), + tak(z-1, x, y)) + end +end + +tak(18, 9, 0) + diff --git a/benchmark/other-lang/tak.scm b/benchmark/other-lang/tak.scm index 45cc576767..52a7629ee5 100644 --- a/benchmark/other-lang/tak.scm +++ b/benchmark/other-lang/tak.scm @@ -1,10 +1,10 @@ -(define (tak x y z)
- (if (not (< y x))
- z
- (tak (tak (- x 1) y z)
- (tak (- y 1) z x)
- (tak (- z 1) x y))))
-
-(tak 18 9 0)
-
-
+(define (tak x y z) + (if (not (< y x)) + z + (tak (tak (- x 1) y z) + (tak (- y 1) z x) + (tak (- z 1) x y)))) + +(tak 18 9 0) + + diff --git a/benchmark/report.rb b/benchmark/report.rb index 99def55aee..8305330b45 100644 --- a/benchmark/report.rb +++ b/benchmark/report.rb @@ -1,81 +1,81 @@ -#
-# YARV benchmark driver
-#
-
-require 'yarvutil'
-require 'benchmark'
-require 'rbconfig'
-
-def exec_command type, file, w
- <<-EOP
- $DRIVER_PATH = '#{File.dirname($0)}'
- $LOAD_PATH.replace $LOAD_PATH | #{$LOAD_PATH.inspect}
- require 'benchmark'
- require 'yarvutil'
-# print '#{type}'
- begin
- puts Benchmark.measure{
- #{w}('#{file}')
- }.utime
- rescue Exception => exec_command_error_variable
- puts "\t" + exec_command_error_variable.message
- end
- EOP
-end
-
-def benchmark cmd
- rubybin = ENV['RUBY'] || File.join(
- Config::CONFIG["bindir"],
- Config::CONFIG["ruby_install_name"] + Config::CONFIG["EXEEXT"])
-
- IO.popen(rubybin, 'r+'){|io|
- io.write cmd
- io.close_write
- return io.gets
- }
-end
-
-def ruby_exec file
- prog = exec_command 'ruby', file, 'load'
- benchmark prog
-end
-
-def yarv_exec file
- prog = exec_command 'yarv', file, 'YARVUtil.load_bm'
- benchmark prog
-end
-
-$wr = $wy = nil
-
-def measure bench
- file = File.dirname($0) + "/bm_#{bench}.rb"
- r = ruby_exec(file).to_f
- y = yarv_exec(file).to_f
- puts "#{bench}\t#{r}\t#{y}"
-end
-
-def measure2
- r = ruby_exec.to_f
- y = yarv_exec.to_f
- puts r/y
-end
-
-if $0 == __FILE__
- %w{
- whileloop
- whileloop2
- times
- const
- method
- poly_method
- block
- rescue
- rescue2
- }.each{|bench|
- measure bench
- }
-end
-
-
-
-
+# +# YARV benchmark driver +# + +require 'yarvutil' +require 'benchmark' +require 'rbconfig' + +def exec_command type, file, w + <<-EOP + $DRIVER_PATH = '#{File.dirname($0)}' + $LOAD_PATH.replace $LOAD_PATH | #{$LOAD_PATH.inspect} + require 'benchmark' + require 'yarvutil' +# print '#{type}' + begin + puts Benchmark.measure{ + #{w}('#{file}') + }.utime + rescue Exception => exec_command_error_variable + puts "\t" + exec_command_error_variable.message + end + EOP +end + +def benchmark cmd + rubybin = ENV['RUBY'] || File.join( + Config::CONFIG["bindir"], + Config::CONFIG["ruby_install_name"] + Config::CONFIG["EXEEXT"]) + + IO.popen(rubybin, 'r+'){|io| + io.write cmd + io.close_write + return io.gets + } +end + +def ruby_exec file + prog = exec_command 'ruby', file, 'load' + benchmark prog +end + +def yarv_exec file + prog = exec_command 'yarv', file, 'YARVUtil.load_bm' + benchmark prog +end + +$wr = $wy = nil + +def measure bench + file = File.dirname($0) + "/bm_#{bench}.rb" + r = ruby_exec(file).to_f + y = yarv_exec(file).to_f + puts "#{bench}\t#{r}\t#{y}" +end + +def measure2 + r = ruby_exec.to_f + y = yarv_exec.to_f + puts r/y +end + +if $0 == __FILE__ + %w{ + whileloop + whileloop2 + times + const + method + poly_method + block + rescue + rescue2 + }.each{|bench| + measure bench + } +end + + + + diff --git a/benchmark/run.rb b/benchmark/run.rb index e121db497b..7f4899e7dd 100644 --- a/benchmark/run.rb +++ b/benchmark/run.rb @@ -1,123 +1,123 @@ -#
-# Ruby benchmark driver
-#
-
-require 'benchmark'
-require 'rbconfig'
-
-$matzrubyonly = false
-$rubyonly = false
-
-$results = []
-
-# prepare 'wc.input'
-def prepare_wc_input
- wcinput = File.join(File.dirname($0), 'wc.input')
- wcbase = File.join(File.dirname($0), 'wc.input.base')
- unless FileTest.exist?(wcinput)
- data = File.read(wcbase)
- 13.times{
- data << data
- }
- open(wcinput, 'w'){|f| f.write data}
- end
-end
-
-prepare_wc_input
-
-def bm file
- prog = File.readlines(file).map{|e| e.rstrip}.join("\n")
- return if prog.empty?
-
- /[a-z]+_(.+)\.rb/ =~ file
- bm_name = $1
- puts '-----------------------------------------------------------' unless $rubyonly || $matzrubyonly
- puts "#{bm_name}: "
-
-
-puts <<EOS unless $matzrubyonly || $rubyonly
-#{prog}
---
-EOS
- begin
- result = [bm_name]
- result << matzruby_exec(file) unless $rubyonly
- result << ruby_exec(file) unless $matzrubyonly
- $results << result
-
- rescue Exception => e
- puts
- puts "** benchmark failure: #{e}"
- puts e.backtrace
- end
-end
-
-def benchmark file, bin
- m = Benchmark.measure{
- `#{bin} #{$opts} #{file}`
- }
- sec = '%.3f' % m.real
- puts " #{sec}"
- sec
-end
-
-def ruby_exec file
- print 'ruby'
- benchmark file, $ruby_program
-end
-
-def matzruby_exec file
- print 'matz'
- benchmark file, $matzruby_program
-end
-
-if $0 == __FILE__
- ARGV.each{|arg|
- case arg
- when /\A--ruby=(.+)/
- $ruby_program = $1
- when /\A--matzruby=(.+)/
- $matzruby_program = $1
- when /\A--opts=(.+)/
- $opts = $1
- when /\A(-r|--only-ruby)\z/
- $rubyonly = true
- when /\A(-m|--only-matzruby)\z/
- $matzrubyonly = true
- end
- }
- ARGV.delete_if{|arg|
- /\A-/ =~ arg
- }
-
- puts "MatzRuby:"
- system("#{$matzruby_program} -v")
- puts "Ruby:"
- system("#{$ruby_program} -v")
- puts
-
- if ARGV.empty?
- Dir.glob(File.dirname(__FILE__) + '/bm_*.rb').sort.each{|file|
- bm file
- }
- else
- ARGV.each{|file|
- Dir.glob(File.join(File.dirname(__FILE__), file + '*')){|ef|
- # file = "#{File.dirname(__FILE__)}/#{file}.rb"
- bm ef
- }
- }
- end
-
- puts
- puts "-- benchmark summary ---------------------------"
- $results.each{|res|
- print res.shift, "\t"
- (res||[]).each{|result|
- /([\d\.]+)/ =~ result
- print $1 + "\t" if $1
- }
- puts
- }
-end
-
+# +# Ruby benchmark driver +# + +require 'benchmark' +require 'rbconfig' + +$matzrubyonly = false +$rubyonly = false + +$results = [] + +# prepare 'wc.input' +def prepare_wc_input + wcinput = File.join(File.dirname($0), 'wc.input') + wcbase = File.join(File.dirname($0), 'wc.input.base') + unless FileTest.exist?(wcinput) + data = File.read(wcbase) + 13.times{ + data << data + } + open(wcinput, 'w'){|f| f.write data} + end +end + +prepare_wc_input + +def bm file + prog = File.readlines(file).map{|e| e.rstrip}.join("\n") + return if prog.empty? + + /[a-z]+_(.+)\.rb/ =~ file + bm_name = $1 + puts '-----------------------------------------------------------' unless $rubyonly || $matzrubyonly + puts "#{bm_name}: " + + +puts <<EOS unless $matzrubyonly || $rubyonly +#{prog} +-- +EOS + begin + result = [bm_name] + result << matzruby_exec(file) unless $rubyonly + result << ruby_exec(file) unless $matzrubyonly + $results << result + + rescue Exception => e + puts + puts "** benchmark failure: #{e}" + puts e.backtrace + end +end + +def benchmark file, bin + m = Benchmark.measure{ + `#{bin} #{$opts} #{file}` + } + sec = '%.3f' % m.real + puts " #{sec}" + sec +end + +def ruby_exec file + print 'ruby' + benchmark file, $ruby_program +end + +def matzruby_exec file + print 'matz' + benchmark file, $matzruby_program +end + +if $0 == __FILE__ + ARGV.each{|arg| + case arg + when /\A--ruby=(.+)/ + $ruby_program = $1 + when /\A--matzruby=(.+)/ + $matzruby_program = $1 + when /\A--opts=(.+)/ + $opts = $1 + when /\A(-r|--only-ruby)\z/ + $rubyonly = true + when /\A(-m|--only-matzruby)\z/ + $matzrubyonly = true + end + } + ARGV.delete_if{|arg| + /\A-/ =~ arg + } + + puts "MatzRuby:" + system("#{$matzruby_program} -v") + puts "Ruby:" + system("#{$ruby_program} -v") + puts + + if ARGV.empty? + Dir.glob(File.dirname(__FILE__) + '/bm_*.rb').sort.each{|file| + bm file + } + else + ARGV.each{|file| + Dir.glob(File.join(File.dirname(__FILE__), file + '*')){|ef| + # file = "#{File.dirname(__FILE__)}/#{file}.rb" + bm ef + } + } + end + + puts + puts "-- benchmark summary ---------------------------" + $results.each{|res| + print res.shift, "\t" + (res||[]).each{|result| + /([\d\.]+)/ =~ result + print $1 + "\t" if $1 + } + puts + } +end + diff --git a/benchmark/runc.rb b/benchmark/runc.rb index 20e06b2355..14ab171c12 100644 --- a/benchmark/runc.rb +++ b/benchmark/runc.rb @@ -1,29 +1,29 @@ -#
-#
-#
-
-require 'benchmark'
-require 'rbconfig'
-
-$rubybin = ENV['RUBY'] || File.join(
- Config::CONFIG["bindir"],
- Config::CONFIG["ruby_install_name"] + Config::CONFIG["EXEEXT"])
-
-def runfile file
- puts file
- file = File.join(File.dirname($0), 'contrib', file)
- Benchmark.bm{|x|
- x.report('ruby'){
- system("#{$rubybin} #{file}")
- }
- x.report('yarv'){
- system("#{$rubybin} -rite -I.. #{file}")
- }
- }
-end
-
-ARGV.each{|file|
- runfile file
-}
-
-
+# +# +# + +require 'benchmark' +require 'rbconfig' + +$rubybin = ENV['RUBY'] || File.join( + Config::CONFIG["bindir"], + Config::CONFIG["ruby_install_name"] + Config::CONFIG["EXEEXT"]) + +def runfile file + puts file + file = File.join(File.dirname($0), 'contrib', file) + Benchmark.bm{|x| + x.report('ruby'){ + system("#{$rubybin} #{file}") + } + x.report('yarv'){ + system("#{$rubybin} -rite -I.. #{file}") + } + } +end + +ARGV.each{|file| + runfile file +} + + diff --git a/benchmark/wc.input.base b/benchmark/wc.input.base index 88b5c69c96..41143fbac0 100644 --- a/benchmark/wc.input.base +++ b/benchmark/wc.input.base @@ -1,25 +1,25 @@ -Subject: Re: Who was Izchak Miller?
-From: "Jane D. Anonymous" <nobody@yale.edu>
-Date: 1996/04/28
-Message-Id: <4lv7bc$oh@news.ycc.yale.edu>
-References: <317C405E.5DFA@panix.com> <4lk6vl$gde@ns.oar.net>
-To: 75176.2330@compuserve.com
-Content-Type: text/plain; charset=us-ascii
-Organization: Yale University
-X-Url: news:4lk6vl$gde@ns.oar.net
-Mime-Version: 1.0
-Newsgroups: rec.games.roguelike.nethack
-X-Mailer: Mozilla 1.1N (Macintosh; I; 68K)
-
-Hello there, Izchak Miller was my father. When I was younger I spent
-many a night, hunched over the keyboard with a cup of tea, playing
-nethack with him and my brother. my dad was a philosopher with a strong
-weakness for fantasy/sci fi. I remember when he started to get involved
-with the Nethack team- my brother's Dungeons and Dragons monster book
-found a regular place beside my dad's desk. it's nice to see him living
-on in the game he loved so much :-).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References: <317C405E.5DFA@panix.com> <4lk6vl$gde@ns.oar.net> +To: 75176.2330@compuserve.com +Content-Type: text/plain; charset=us-ascii +Organization: Yale University +X-Url: news:4lk6vl$gde@ns.oar.net +Mime-Version: 1.0 +Newsgroups: rec.games.roguelike.nethack +X-Mailer: Mozilla 1.1N (Macintosh; I; 68K) + +Hello there, Izchak Miller was my father. When I was younger I spent +many a night, hunched over the keyboard with a cup of tea, playing +nethack with him and my brother. my dad was a philosopher with a strong +weakness for fantasy/sci fi. I remember when he started to get involved +with the Nethack team- my brother's Dungeons and Dragons monster book +found a regular place beside my dad's desk. it's nice to see him living +on in the game he loved so much :-). + Tamar Miller + +The following is a really long word of 5000 characters: + +wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww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