Froze rails gems
[depot.git] / vendor / rails / railties / lib / commands / performance / benchmarker.rb
1 if ARGV.empty?
2 puts "Usage: ./script/performance/benchmarker [times] 'Person.expensive_way' 'Person.another_expensive_way' ..."
3 exit 1
4 end
5
6 begin
7 N = Integer(ARGV.first)
8 ARGV.shift
9 rescue ArgumentError
10 N = 1
11 end
12
13 require RAILS_ROOT + '/config/environment'
14 require 'benchmark'
15 include Benchmark
16
17 # Don't include compilation in the benchmark
18 ARGV.each { |expression| eval(expression) }
19
20 bm(6) do |x|
21 ARGV.each_with_index do |expression, idx|
22 x.report("##{idx + 1}") { N.times { eval(expression) } }
23 end
24 end