Rails 3.0.3 performing extremely slow on certain views
I just upgraded from Rails 2.3.11 to Rails 3.0.3. Overall the performance is fine but some views (about 5 out o开发者_C百科f a project of about 200 views) perform extremely slow. I tested with both Enterprise Ruby (1.8.7) and Ruby 1.9.2 (p180) getting the exact same behavior.
In newrelic I see that 98% of the performance is taken for the view so it seems not to be database related. Also watching webrick the request itself is very fast, but it takes ages for the request to initially show up in the webrick console (maybe stuck in Rack?). I guess it's something I am doing in the view, but I really don't know what... I posted the code of one of the critical views below. Maybe someone has an idea?
Main View: http://dl.dropbox.com/u/2964182/show.html.erb Partial 1: http://dl.dropbox.com/u/2964182/_vote_arguments.html.erb Partial 2: http://dl.dropbox.com/u/2964182/_active_filter.html.erb Controller: http://dl.dropbox.com/u/2964182/public_votes_controller.rb
Thanks, Gabriel
My first suggestion, although a bit crude, would be just to cut out some elements of the view code that you think might be causing the bottleneck and see if the views load any faster without, until hopefully you work out what it is.
Are there any significant differences between the code loaded into the slow views and those that are running fine.
精彩评论