Ruby on Rails
BenchmarkerScript

Rails 0.12 (19th April, 2005) Added script/benchmarker to easily benchmark one or more statement a number of times from within the Rails environment.

Usage:


benchmarker times 'Person.expensive_way' 'Person.another_expensive_way' ... 

Examples:


  # runs the one statement 10 times
  script/performance/benchmarker 10 'Person.expensive_method(10)'


  # pits the two statements against each other with 50 runs each
  script/performance/benchmarker 50 'Person.expensive_method(10)' 'Person.cheap_method(10)'

$ ruby script/performance/benchmarker 50 'Keyword.popular_keywords' 'Keyword.popular_keywords(10)'
            user     system      total        real
#1      0.060000   0.010000   0.070000 (  0.699459)
#2      0.070000   0.020000   0.090000 (  0.498171)     

See also