Was ist schneller "zählen" oder "Länge"?
Angenommen, es werden 2 Modelle genanntUser
undPost
Welches ist die bessere Leistung (schnell), entweder "Plan A" oder "Plan B"?
"Plan A"
Regler
@users = User.find_all_by_country(params[:country])
@posts = Post.find_all_by_category(params[:category])
Aussicht
<%= @users.count.to_s %>
<%= @posts.count.to_s %>
"Plan B"
Regler
@users = User.find_all_by_country(params[:country])
@posts = Post.find_all_by_category(params[:category])
Aussicht
<%= @users.length.to_s %>
<%= @posts.length.to_s %>