The core performance team spent a lot of time this year looking into the performance of the i18n/l10n system in WordPress, after proving that loading translations had a significant hit on response time. This led to an in-depth performance analysis, followed by a dedicated Performant Translations feature plugin offering significant performance boosts for all WordPress sites with zero configuration. Thousands of sites successfully tested the plugin under a wide variety of conditions. Now, the team believes the solution is ready for inclusion in WordPress core.
What it does
Performant Translations is powered by a new, lightweight i18n library that is faster at loading binary MO files and uses less memory. It even supports loading multiple locales at the same time, which makes locale switching faster. In addition to that, it supports translations contained in PHP files, avoiding a binary file format and leveraging OPCache if available. If an MO translation file has a corresponding PHP file, the latter will be loaded instead, making things even faster and use even less memory. In raw numbers, this is how great the optimization is with this approach:
|Locale||Scenario||Memory Usage||Load Time|
|en_US||Default||15 MB||159 ms|
|de_DE||Default||29 MB||217 ms|
|de_DE||Performant Translations||17 MB||166 ms|
These numbers were taken by testing the Performant Translations plugin against WordPress 6.5-alpha-57028 with the Twenty Twenty-One theme and a few active plugins. As you can see, memory usage and load time overhead are reduced to a minimum.
The core performance team has opened #59656 to track merging Performant Translations into core in time for the next 6.5 release. A pull request is already available and currently undergoing code review. Once that is completed, it will be ready to be merged into trunk where the library will be able to see even wider testing.
There is also a Meta patch ready for serving PHP files as part of language packs shipped by translate.wordpress.org, building upon a GlotPress PR. Both are in need of code review right now. While these two changes unlock the full power of Performant Translations, they are not blockers for the core merge and could even land later.
The Performant Translations plugin will continue to be maintained even after a core merge to build on top of the core solution with a distinct additional feature. As is already the case today, the plugin will automatically convert any MO files to PHP files if a PHP file does not currently exist. This is useful for sites where translations are not coming from translate.wordpress.org or only exist locally on that server.