[wp-trac] [WordPress Trac] #59656: Merge Performant Translations (Ginger MO)

WordPress Trac noreply at wordpress.org
Tue Oct 17 13:26:51 UTC 2023


#59656: Merge Performant Translations (Ginger MO)
-------------------------+--------------------------------------
 Reporter:  swissspidy   |      Owner:  swissspidy
     Type:  enhancement  |     Status:  assigned
 Priority:  normal       |  Milestone:  6.5
Component:  I18N         |    Version:
 Severity:  normal       |   Keywords:  has-patch has-unit-tests
  Focuses:  performance  |
-------------------------+--------------------------------------
 Today, sites using
 Over the past half a year or so, the core performance team spent
 significant time on  extensively analyzing i18n performance in WordPress
 and finding ways to improve it. This cumulated in the
 [https://wordpress.org/plugins/performant-translations/ Performance
 Translations] feature plugin, which uses PHP files in favor of MO files
 for translations, which is much faster and benefits from OPcache as well.

 This ticket tracks the suggestion of merging Performant Translations,
 which was originally developed by @dd32 under the name Ginger MO, into
 WordPress core. **Note: a make/core post detailing the merge will be
 published separately.**

 Performant Translations supports multiple file formats (`.mo` and `.php`),
 as well as multiple text domains and locales loaded at the same time.

 This means:

 * Loading `.mo` files as usual will be much faster and use less memory
 * If an `.mo` translation file has a corresponding `.php` file, that file
 will be loaded instead, making things even faster and use even less memory
 * When switching locales, we no longer have to unload the previous
 translations, but can instead keep them in memory, making locale switching
 much cheaper

 A quick comparison:

 || Locale ||        Scenario         || Memory Usage || Load Time ||
 || en_US  ||         Default         ||   14.46 MB   || 124.66 ms ||
 || de_DE  ||         Default         ||   27.96 MB   || 173.44 ms ||
 || de_DE  || Performant Translations ||   15.62 MB   || 132.60 ms ||

 As you can see, translations used to massively slow down a site, but with
 this new library, there is little to no additional overhead.

 * [https://make.wordpress.org/core/2023/07/24/i18n-performance-analysis/
 i18n performance analysis], contains extensive benchmarks and comparisons
 of various alternative solutions
 * [https://make.wordpress.org/core/2023/09/05/call-for-testing-performant-
 translations/ Call for testing for Performant Translations]

 Since this uses a new file format for translations, some changes are
 required to add support for it in related places such as
 translate.wordpress.org.

 Relevant companion tickets:

 * [https://github.com/WordPress/wordpress-develop/pull/5306 Core patch]
 * [https://github.com/GlotPress/GlotPress/pull/1626 GlotPress patch]
 * [https://meta.trac.wordpress.org/ticket/7296 Meta patch]

 Everything is 100% backward compatible and if there are no PHP translation
 files, MO files will be loaded as usual.

 -----

 Related: this is an alternative to #17268

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59656>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list