Sha256: e7f12b99505f8f62a074f0682910e8d9743e0b2edece298bb5c70c18c5674fd7
Contents?: true
Size: 496 Bytes
Versions: 42
Compression:
Stored size: 496 Bytes
Contents
if [nil, "-h", "--help"].include?(ARGV.first) puts "Usage: rails benchmarker [times] 'Person.expensive_way' 'Person.another_expensive_way' ..." exit 1 end begin N = Integer(ARGV.first) ARGV.shift rescue ArgumentError N = 1 end require 'benchmark' include Benchmark # Don't include compilation in the benchmark ARGV.each { |expression| eval(expression) } bm(6) do |x| ARGV.each_with_index do |expression, idx| x.report("##{idx + 1}") { N.times { eval(expression) } } end end
Version data entries
42 entries across 42 versions & 1 rubygems