Hi, I have a controller action which is taking 10 seconds to run. Most of the time is being spent in a view which is a large file.(more than 1500 lines). How shall I go about debugging the speed issue?
Hi Srimanta,
You can debug this using the method benchmark at various points of the code to find where it is taking time in models, controllers and in views.
Explore more in http://guides.rubyonrails.org/performance_testing.html#helper-methods
Lines of code is not always proportional to the speed of the execution of the code, but quality is.
- Neethu
Neethu Satheesh wrote in post #1043873:
Hi Srimanta,
You can debug this using the method benchmark at various points of the code to find where it is taking time in models, controllers and in views.
Explore more in http://guides.rubyonrails.org/performance_testing.html#helper-methods
Lines of code is not always proportional to the speed of the execution of the code, but quality is.
- Neethu
Hi Neethu, Thanks once again
Quoting Srimanta Chakraborty <lists@ruby-forum.com>:
Hi, I have a controller action which is taking 10 seconds to run. Most of the time is being spent in a view which is a large file.(more than 1500 lines). How shall I go about debugging the speed issue?
Profile it. See which methods are being called, how often, etc. Google "profile rails request".
Jeffrey