ruby: 1.8.7 rails: 3.0.4
在 search_right.html.erb 中,render partial 时候,本机基本在 1ms 左右,但是偶尔会有一个 partial 渲染的时间 特别长,这里竟然达到了 223ms, 而且不固定会出现在那一个 item 的渲染上,是不是 rails 的 bug?
search_right.html.erb:
<% @paginated_hits.each_with_index do |hit, index| %>
<%= render :partial => "search/search_item",:locals => {:hit => hit,:index =>index} %>
<% end %>
search_item.html.erb:
<tr>
<td> "test" </td>
</tr>
查看 log 信息如下:
16:08:52 action_view_Rendered search/_product_search_item.html.erb (0.8ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (0.6ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (0.7ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (0.6ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (0.7ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (0.7ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (1.4ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (0.9ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (0.8ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (0.6ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (0.7ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (223.0ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (0.9ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (0.9ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (1.0ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (1.0ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (1.0ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (1.1ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (1.0ms)
16:08:52 action_view_Rendered search/_product_search_item.html.erb (0.9ms)
16:08:52 action_view_Rendered search/_product_search_right.html.erb (378.9ms)