Sha256: 9840d82191da4d2211bab6d0b70213cefe8c1e3f5f67cdb66b302f0b1ba08dbb

Contents?: true

Size: 543 Bytes

Versions: 3

Compression:

Stored size: 543 Bytes

Contents

#!/usr/local/bin/ruby

if ARGV.empty?
  puts "Usage: ./script/perform 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 RAILS_ROOT + '/config/environment'
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

3 entries across 3 versions & 1 rubygems

Version Path
rails-0.14.1 lib/commands/performance/benchmarker.rb
rails-0.14.2 lib/commands/performance/benchmarker.rb
rails-0.14.3 lib/commands/performance/benchmarker.rb