cache item-preview-species on items#show

items#show has been very slow recently, and I think it's because there's a lot
of querying to be done. Another option would have been to attempt to
short-circuit Item#supported_species if not body specific, but that would
still leave us with 1s load times for body specific items, which is not
satisfactory. The short-circuiting might still be worth doing, but probably
not now.

I'm also not sure that this is actually the core performance problem, but
we'll see. It definitely helped on the dev server: items#show took about
200ms on item pages where everything but species images were cached, then
took about 30ms on subsequent loads. Looking like a good candidate.
This commit is contained in:
Emi Matchu 2013-06-21 19:30:41 -07:00
parent a9f4c14a96
commit 154bdd5d0d

View file

@ -78,7 +78,13 @@
:class => 'button' :class => 'button'
#item-preview #item-preview
#item-preview-species= standard_species_images_for(@item) #item-preview-species
-# Does this cache ever need to be swept? I don't think so. These days we
-# can identify body-specific items instantly, and, if it's instead
-# particular to a single species, we definitely know that the first time
-# we render.
- localized_cache "items/#{@item.id} item_preview_species" do
= standard_species_images_for(@item)
#item-preview-error #item-preview-error
#item-preview-swf= t '.preview.requirements_not_met' #item-preview-swf= t '.preview.requirements_not_met'