forked from OpenNeo/impress
Matchu
7948974949
I used the new profiler tools on this page, and noticed a lot of allocations in the Globalize library, which we use for translating database records. I realized that we were loading all of the fields of not just all of the items on the page, but all of their translation records in all locales! We used to scrape data for lots of languages, so that can be quite a lot! Unfortunately, Rails's `includes` method to efficiently preload related records always loads all fields, and simply can't be overridden. So, in this change we write manual preloading code, to identify the records we need, load them in big bulk queries, and assign them back to the appropriate associations. Basically just what `includes` does, but written out a bit more, to give us the chance to specify SELECT and WHERE clauses! |
||
---|---|---|
.. | ||
item | ||
application_record.rb | ||
auth_record.rb | ||
auth_user.rb | ||
campaign.rb | ||
closet_hanger.rb | ||
closet_list.rb | ||
closet_visibility.rb | ||
color.rb | ||
contribution.rb | ||
donation.rb | ||
donation_feature.rb | ||
fragment_localization.rb | ||
image.rb | ||
item.rb | ||
item_outfit_relationship.rb | ||
neopets_connection.rb | ||
neopets_page.rb | ||
neopets_user.rb | ||
outfit.rb | ||
parent_swf_asset_relationship.rb | ||
pet.rb | ||
pet_attribute.rb | ||
pet_state.rb | ||
pet_type.rb | ||
pretty_param.rb | ||
species.rb | ||
static_resource.rb | ||
swf_asset.rb | ||
user.rb | ||
zone.rb |