title: Rails development mode renders views extremely slow
body: <p>With <em>nothing</em> happening in the controller besides <code>render 'mypage'</code>, and <em>nothing</em> happening in the view besides HTML (I've commented out all the Ruby code in both places), it still takes over 5 seconds to load the page:</p>
  
  <pre><code>Completed 200 OK in 6258ms (Views: 5283.2ms | ActiveRecord: 14.6ms)
  </code></pre>
  
  <p>Any suggestions on how I can either improve this or profile it?  Every 'solution' I've come across has no effect for me.  Rails-dev-tweaks doesn't make an impact, changing the assets debug flag has no effect; I actually believe this all happens <em>before</em> assets are requested.</p>
  
  <p><strong>Update</strong> 07 May 1450</p>
  
  <p>Hi all - thanks for the replies.  Let me start off by saying I <em>have</em> narrowed this down to assets; removing about a half dozen gems and all assets has brought the page load time down to 1.3s for the first load, and reloading is ~150ms.  Fantastic.  So my problem now becomes how to properly configure a gem like rails-dev-tweaks to get it going; I can't seem to find the right config that will.  We have probably a hundred or so assets - maybe a little more.</p>
  
  <p>To answer your questions:
  I unfortunately can't copy and paste the view; however, suffice to say it is about 100 lines of HTML, 10 lines of javascript, and maybe 30 of the HTML lines have some Ruby code in it, but I commented out all the Ruby.</p>
  
  <p>I tried ruby-prof - didn't give me anything really useful</p>
  
  <p>No external HTTP requests are being made</p>
  
  <p>There is a before_filter in the ApplicationController, but even commenting that out didn't make a huge difference.</p>
  
  <p>I'm developing on Mac OS X 10.8</p>
  
  <p>I'm using Rails 3.2.13</p>
  
  <p>With no assets at all:
  The first page load:</p>
  
  <pre><code>Completed 200 OK in 3418ms (Views: 1414.9ms | ActiveRecord: 74.6ms)
  </code></pre>
  
  <p>Refreshing the page:</p>
  
  <pre><code>Completed 200 OK in 140ms (Views: 120.8ms | ActiveRecord: 2.8ms)
  </code></pre>
  
  <p>Interestingly, <code>rails -v</code> takes 4 seconds to load:</p>
  
  <pre><code>ruby-1.9.3-p327@aidin ± time rails -v
      Rails 3.2.13
      rails -v  4.10s user 0.24s system 92% cpu 4.679 total
  </code></pre>
  
  <p><strong>Update 2</strong> 07 May 1450</p>
  
  <p>New Relic tells me there's an inordinate amount of time taken in what I believe is a Rails dependency (actually an ActionPack dependency), Journey itself:</p>
  
  <pre><code>                  Metric    Timestamp (s)   Duration (ms)   Exclusive (ms)
  DashboardController#show    0.001           2,652           1917
  </code></pre>
  
  <p>The detail page shows me this file:</p>
  
  <pre><code>journey-1.0.4/lib/journey/router.rb
  </code></pre>
  
  <p>And this line:</p>
  
  <pre><code>        status, headers, body = route.app.call(env)
  </code></pre>
  
  <p><strong>Update 3</strong> 07 May @ 1509</p>
  
  <p>Further investigation reveals that in addition to removing all assets, removing all gems decreases the response time to an acceptable ~150ms.  Putting the gems back in moves it to 800ms to 1500ms; clearly there's something going on in those alone that's causing problems.</p>
  
  <p>If anyone thinks they can pick out which gems are causing problems I'm happy to post the Gemfile</p>