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

Version Path
railties-3.0.20 lib/rails/commands/benchmarker.rb
railties-3.0.19 lib/rails/commands/benchmarker.rb
railties-3.0.18 lib/rails/commands/benchmarker.rb
railties-3.0.17 lib/rails/commands/benchmarker.rb
railties-3.0.16 lib/rails/commands/benchmarker.rb
railties-3.0.15 lib/rails/commands/benchmarker.rb
railties-3.0.14 lib/rails/commands/benchmarker.rb
railties-3.0.13 lib/rails/commands/benchmarker.rb
railties-3.0.13.rc1 lib/rails/commands/benchmarker.rb
railties-3.0.12 lib/rails/commands/benchmarker.rb
railties-3.0.12.rc1 lib/rails/commands/benchmarker.rb
railties-3.0.11 lib/rails/commands/benchmarker.rb
railties-3.0.10 lib/rails/commands/benchmarker.rb
railties-3.0.10.rc1 lib/rails/commands/benchmarker.rb
railties-3.0.9 lib/rails/commands/benchmarker.rb
railties-3.0.9.rc5 lib/rails/commands/benchmarker.rb
railties-3.0.9.rc4 lib/rails/commands/benchmarker.rb
railties-3.0.9.rc3 lib/rails/commands/benchmarker.rb
railties-3.0.9.rc1 lib/rails/commands/benchmarker.rb
railties-3.0.8 lib/rails/commands/benchmarker.rb