【发布时间】:2011-07-23 11:24:56
【问题描述】:
第一个代码:
# matches/index.html.haml
%ul.match_list
- @matches.each do |match|
%li
=render match
# matches/_match.html.haml
%li
=match.id
Completed 200 OK in 665ms (Views: 496.3ms | ActiveRecord: 142.1ms)
慢得要命。
第二个代码:
# matches/index.html.haml
%ul.match_list
- @matches.each do |match|
%li
=match.id
Completed 200 OK in 196ms (Views: 30.0ms | ActiveRecord: 134.6ms)
好多了。
为什么不使用 partial 会快很多?
【问题讨论】:
-
抱歉,我第一次发表评论时看不到结果。
-
开发还是生产模式?
-
它的开发模式,在生产中尝试一下
-
在生产模式下运行是否解决了这个问题?
标签: ruby-on-rails ruby-on-rails-3 views partials