I am getting bad performance after upgrading an application to Rails 3.
Before upgrading, I got 60ms - 100ms response times.
After upgrading, I get 300ms - 1500ms response times.
The log shows a sample response time from each time:
Rails 3.0.0: Completed 200 OK in 1454ms (Views: 1314.6ms | ActiveRecord: 25.1ms)
Rails 2.3.8: Completed in 31ms (View: 27, DB: 1) | 200 OK [FILTERED]
I've tried running using passenger and 'rails server' (both results are close). I've created two identical applications (running in 2.3.8 and 3.0.0) to demonstrate the performance differences. The code that appears to be causing the performance issues is:
<%- @posts.each do |post| -%>
<h1><%= post.title %></h1>
<p><%=truncate post.body %></p>
<%- post.comments.each do |comment| -%>
<h2><%= comment.title%></h2>
<p><%=truncate comment.body %></p>
<ul>
<%- comment.ratings.each do |rating| -%>
<li><%=truncate rating.notes %></li>
<%- end -%>
</ul>
<%- end -%>
<%- end -%>
For full source, the projects are available here: http://github.com/ksylvest/performance
Thanks!