Prev | Current Page 227 | Next

Brad Ediger

"Advanced Rails"

The tool also requires a syslogd that supports filtering
on program names, which usually means either running BSD or installing syslog-ng.
For these reasons, we will not go into detail on its use here. Complete setup instructions
are available at http://rails-analyzer.rubyforge.org/pl_analyze/.
Action profiler
Once you know which actions are hurting for performance, you need a way to dig
deeper. Action Profiler is a library (and a corresponding executable, action_profiler)
that glues Rails to a profiler. It profiles a single Rails action through the entire Rails
stack and application code so that you can examine where the most time is being
spent during that action.
Action Profiler can be used with one of several profiling engines: ZenProfiler, rubyprof,
and Ruby??™s built-in Profiler class. They will be tried in that order unless one is
specified on the command line with the -P option. Here is a sample run of Ruby??™s
Profiler, showing a flat call profile:
$ action_profiler -P Profiler ListingController#map
Warmup...
Profiling...
% cumulative self self total
time seconds seconds calls ms/call ms/call name
13.73 0.07 0.07 204 0.34 0.34 ERB::Util.html_escape
11.76 0.13 0.06 1462 0.04 0.08 String#gsub
11.76 0.19 0.06 6 10.00 10.00 AssetTagHelper.
compute_public_path
9.80 0.24 0.05 89 0.56 0.67 FormOptionsHelper.
option_value_selected?
9.80 0.29 0.05 178 0.


Pages:
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239