[wp-hackers] Fix that translated WordPress takes 86% longer to start

Nikolay Bachiyski nb at nikolay.bg
Mon Feb 23 11:36:49 GMT 2009

On Thu, Feb 19, 2009 at 22:47, Johan Eenfeldt <johan.eenfeldt at gmail.com> wrote:
> Solution 2: cache i10n object (in this case using APC)

Caching it locally sounds like the best approach, because it is used
in virtually every request and the files are big.

We have tried caching it remotely in memcached on WordPress.com, but
it wasn't any faster than reading the MO files locally.

> 2 is possible to implement with a plugin by adding a filter to
> load_textdomain(). If noone tells me its a bad idea :) I'll add a trac
> item and see what happens.

Allowing you re write your own load_textdomain is reasonable.

> Splitting the mo file and handling the result can be done with a
> plugin already. I don't however really see a reason why it isn't the
> standard setup:
> - it takes back much of the cost of translation
> - it makes the i10n object ~300k smaller (for each thread/process)
> - the split can easily be scripted

Effective splitting is not that easy. Although all strings defined in
wp-admin are used only there, there are many strings in wp-includes,
which are also used only in admin context. Gettext doesn't support
string tagging out of the box.

Happy hacking,

More information about the wp-hackers mailing list