Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (21 sloc) 468 Bytes
require "benchmark"
require "json"
puts RUBY_DESCRIPTION
abort "Needs Ruby name" if ARGV.empty?
NAME = ARGV.shift
FLAGS = ARGV.join(' ')
BENCHMARKS = File.readlines("benchmarks.txt").map(&:chomp)
N = 10
data = BENCHMARKS.map { |bench|
puts bench
times = N.times.map {
time = Benchmark.realtime {
`ruby #{FLAGS} -r./compat #{bench}`
}
print "%.3f " % time
time
}
puts
[bench, times]
}.to_h
File.write "#{NAME}.json", JSON.dump(data)