Where is the rest of the response time coming from?
I'm running a local copy of the railscasts website to get familiar with rails 3. I was examining the development log after I was clicking around, and here's what I see:
Started GET "/" for 127.0.0.1 at 2010-12-16 14:17:07 -0500
Processing by EpisodesController#index as HTML
Episode Load (0.5ms) SELECT "episodes".* FROM "episodes" WHERE (published_at <= '2010-12-16 19:17:07.872204') ORDER BY position DESC LIMIT 10 OFFSET 0
Rendered shared/_navigation.html.erb (1.4ms)
Sponsor Load (0.2ms) SELECT "sponsors".* FROM "sponsors" WHERE (active = 't')
Tag Load (0.1ms) SELECT "tags".* FROM "tags" ORDER BY name
Rendered shared/_side.html.erb (4.2ms)
Rendered episodes/index.html.erb within layouts/application (9.8ms)
Complete开发者_如何学God 200 OK in 117ms (Views: 12.7ms | ActiveRecord: 0.8ms | Sphinx: 0.0ms)
Where is the rest of the response time coming from? It says 117ms for the full request and it looks like it's logging all database queries. Is the remaining time really just controller logic?
The problem was simple. This is a development log snippet, so all of that extra time was gobbled up by rails reloading the classes.
The rest of the time would go to:
- Controller, view, model logic
- Sending/receiving the HTTP data
- Rails internals
- Logging, printing the console
精彩评论