Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 21 lines (21 sloc) 0.53 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
def bench(e, options)
  puts e
  ['./miniruby', 'ruby1.9'].each do |r|
    puts `#{r} -v`.strip
    line = File.exist?(e) ? "#{r} \"#{e}\"" : "#{r} -e \"#{e}\""
    n = options.include?('--no-rehearsal') ? 1 : 3
    n.times do
      t = Time.now
      v = system(line) ? Time.now - t : nil
      puts ' ' + v.to_s
    end
  end
end
options = []
expressions = []
while e = ARGV.shift
  a = /^-/.match(e) ? options : expressions
  a << e
end
expressions.map! { |e| e.gsub(/"/, '\"') }
expressions.each { |e| bench(e, options) }
Something went wrong with that request. Please try again.