WordPress Performance Analysis Finds Translations May Significantly Slow Down Sites

After a recent in-depth performance analysis earlier this year showed that translations can have an impact on server response times, WordPress contributors are proposing half a dozen technical solutions for consideration to improve performance for the ~56% of WordPress sites that use translations.

“Initial benchmarks showed that the median loading time for a localized site can be up to 50% slower than for non-localized sites, depending on which themes and plugins are being used,” Google-sponsored WordPress core committer Pascal Birchler said.

Based on recent discussions on GitHub, the Performance team has whittled it down to an updated list of six possible top contenders for speeding up sites with translations, including the advantages and disadvantages of each:

Solution A: Use different file format

Solution B: Native gettext extension

Solution C: Cache translations

Solution D: Lazily evaluated translation calls

Solution E: Optimize/Rewrite existing MO parser

Solution F: Splitting up translation files

Localized WordPress sites currently download .po and .mo files that contain the translations, but the first suggested solution proposes storing translations in .php files and using the .mo file as a fallback, as Birchler proposes that PHP loading and executing another PHP file would be a faster approach. He has a proof of concept on GitHub at at swissspidy/wp-php-translation-files and swissspidy/ginger-mo.

“When looking at all these factors, it appears that a revamped translations parser (solution E) could bring the most significant improvements to all localized WordPress sites,” Birchler said. “Especially when combined with a new PHP translation file format (solution A), which Ginger MO supports, the i18n overhead becomes negligible. Of course the same risks associated with introducing a new format apply.

“On top of that, a revamped i18n library like Ginger MO could also be combined with other solutions such as caching or dynamic MO loading to potentially gain further improvements. However, those routes have yet to be explored.”

The Performance team plans to test these ideas further on a wider scale through its Performance Lab feature project after gathering feedback from the broader community. August 6, 2023, is the deadline for leaving feedback on the proposal, which includes benchmarks and more details from the analysis.