Question

What tools do you recommend to profile Rails apps?

I've been looking for profiling tools for Rails for a while. I'm currently playing and testing ruby-prof and railsbench, but I kinda frustrated with the amount of tweaking and mangling required to make then work.

Althought I don't mind (much) the tweaking, I'd like to know if is there any other, more straight-forward and easy to use, tools to profile a Rails app? Which tools you recommend?

 45  19675  45
1 Jan 1970

Solution

 44

You can use the built in profiler as well:

$ ruby script/performance/profiler 'User.new' 5
  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
189.25     1.76      1.76        1  1760.00  1760.00  Profiler__.start_profile
 43.01     2.16      0.40      115     3.48     3.91  ActiveRecord::ConnectionAdapters::Column#simplified_type
  8.60     2.24      0.08       15     5.33     8.67  Array#each
  7.53     2.31      0.07      115     0.61     5.39  ActiveRecord::ConnectionAdapters::Column#initialize
  6.45     2.37      0.06      115     0.52     0.52  ActiveRecord::ConnectionAdapters::Column#type_cast
  5.38     2.42      0.05      690     0.07     0.07  Regexp#===
  0.00     2.69      0.00       10     0.00     0.00  Process.times
  0.00     2.69      0.00       10     0.00     0.00  Benchmark.times

Note that for Rails 3, you can use rails profiler.

2008-12-10