How can I profile a controller action?
One of my views is taking quite some time to render, and I’d like to break it down. I see script/performance/profiler, but that seems to only have access to the global scope.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
ruby-prof is the way to go. Here’s a howto, How to profile your Rails and Ruby applications with ruby-prof.
If you use it in combination with a visualisation tool such as kcachegrind, you can easily separate the code that is your application code from the framework code.
I gave a talk on these tools at my local Ruby-users group a while back: Making your rails app kick ass with ruby-prof and kcachegrind.