ロード時間を短縮するための手法について検討しています。私は今レンダリング時に大量のデータをレンダリングしているページで作業しています。私は各負荷をステップアップして、時間を最適化できるかどうかを確認しようとしています。ロード時間を短縮するためにデータをプリロードする - レール
私が現在持っている問題はこれです。
(5.4ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23022]]
(4.4ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23023]]
(4.2ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23024]]
(6.0ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23029]]
(7.1ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23121]]
(6.0ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23180]]
(4.2ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23229]]
(4.2ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23250]]
(6.6ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23254]]
(4.4ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23255]]
(4.0ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23259]]
(6.5ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23154]]
(6.6ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23177]]
(5.1ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23201]]
(4.2ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23221]]
(4.1ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23232]]
(7.9ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23235]]
(4.3ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23237]]
(4.1ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23238]]
(5.9ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23248]]
(7.8ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23295]]
(6.8ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23119]]
(4.2ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23123]]
(4.1ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23178]]
(7.9ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23231]]
(4.4ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23239]]
(4.3ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23240]]
(6.4ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23241]]
(5.1ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23243]]
(6.7ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23245]]
(4.3ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23247]]
(4.2ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23249]]
(6.9ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23251]]
(4.4ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23256]]
(4.2ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23257]]
(6.5ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23275]]
(6.4ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23350]]
(5.0ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23272]]
(4.2ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23296]]
(4.0ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23401]]
(8.8ms) SELECT COUNT(*) FROM "attendees" WHERE "attendees"."rsvp_id" = $1 [["rsvp_id", 23347]]
私はこのコードからということになっています:
def number_attending
rsvp.attendees.count
end
ので、出欠は、多くの参加者があります。私はその方法をここに呼んでいる。
<% rsvps.each do |rsvp| %>
<span class="event-response__indicator event-response__indicator--guests" title="<%= rsvp.number_attending %> Guests">
<% end %>
だから問題があります。私はすべてのrsvpと出席者がページの読み込みを繰り返す必要はありません。そのデータをプリロードする方法はありますか? Eagerloadingのようなもの?もしそうなら、私はどのように情報を与えて実装することができますか?
なぜdownvoteを知ることができますか? –