summaryrefslogtreecommitdiff
path: root/benchmark/runc.rb
blob: 14ab171c121a37cb3ced185e38e4605a2d438e3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
}