small medium large xlarge

Me_sq_pragsmall
21 Jun 2015, 22:02
Felix Buenemann (3 posts)

Rails I18n lookups are uncached by default, which can lead to huge slowdowns especially when rendering tables with eg. localized dates.

There is a big speedup if the memoized backend is used, which caches lookups in memory. I usually have the following code in an initializer:

I18n::Backend::Simple.send(:include, I18n::Backend::Memoize) unless Rails.env.development?

This tip might be worth adding to the rails performance section.

0ba3be7_pragsmall
31 Aug 2015, 21:04
Alexander Dymo (9 posts)

Hi Felix, Thanks for the tip! Please include it into the wiki I’ve just started https://github.com/ruby-performance-book/resources/wiki

You must be logged in to comment