Mario Uher
Mario Uher

Reputation: 12397

Rails 3 rendering is so slow

I recently booted up an old version of a Rails project of mine, which uses Rails 2.3.11 and realized that Rails 2.3 is much faster running almost the same code as the recent version.

My question: Is Rails 3 slower than Rails 2? Especially when rendering lots of partials? The old version never really exceeded 300ms for a request, Rails 3 takes 600ms and more, sometimes even 2 seconds. Any workarounds known? Or should I move my partials into helper methods (generating the html)? And no, downgrading is not an option!

Greetings, Mario

Upvotes: 1

Views: 840

Answers (1)

Benjamin Tan Wei Hao
Benjamin Tan Wei Hao

Reputation: 9691

How are you rendering your partials? Rails in development mode can be quite slow. You can try giving this gem a try by adding this to your Gemfile: gem 'rails-dev-boost', :git => 'git://github.com/thedarkone/rails-dev-boost.git', :require => 'rails_development_boost'.

If you are running your partials via a collection, you can always do something like <%= render @posts %> for better performance gains.

Hope this helps!

Upvotes: 1

Related Questions