Ruby on Rails's link_to and edit_foo_path taking 1.3 seconds, while the DB takes only 0.3 seconds for 1000 records?
I am trying a scaffold in Ruby on Rail 3.0.5 with Ruby 1.9.2-p180
Timing the different things to generate the page /foos/index
, for about 1000 records, I found that database data fetching and printing takes only 0.3 seconds and 0.2 seconds for the 1000 records, 开发者_运维知识库but the scaffold links, they take 1.3 seconds to produce (for 1000 records). the time is listed at the end of the code:
link_to 'Show', foo # 0.47 seconds
link_to 'Edit', edit_foo_path(foo) # 0.22 seconds (s)
link_to 'Destroy', foo, :confirm => 'Are you sure?', :method => :delete # 0.57s
that looks extraordinary amount of time, just to produce the links... considering that the real data fetching and printing takes only 1/3 of the time of producing the links.
The first link for example, is merely:
<a href="/foos/1">Show</a>
and it takes 0.5 seconds, even more time than to fetch the real data? shouldn't it be faster, or made faster -- why so slow right now?
精彩评论