1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/bin/benchmarker
David Heinemeier Hansson bd441bb066 Updated to take compilation out of the measurements
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1214 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-04-18 19:03:25 +00:00

19 lines
No EOL
483 B
Ruby

#!/usr/local/bin/ruby
if ARGV.empty?
puts "Usage: benchmarker times 'Person.expensive_way' 'Person.another_expensive_way' ..."
exit
end
require File.dirname(__FILE__) + '/../config/environment'
require 'benchmark'
include Benchmark
# Don't include compilation in the benchmark
ARGV[1..-1].each { |expression| eval(expression) }
bm(6) do |x|
ARGV[1..-1].each_with_index do |expression, idx|
x.report("##{idx + 1}") { ARGV[0].to_i.times { eval(expression) } }
end
end