[wp-trac] [WordPress Trac] #17268: Use native gettext library when available
WordPress Trac
noreply at wordpress.org
Tue Sep 5 19:59:02 UTC 2023
#17268: Use native gettext library when available
-------------------------------------------------+-------------------------
Reporter: linushoppe | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Future
| Release
Component: I18N | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-refresh needs-unit- | Focuses:
tests dev-feedback | performance
-------------------------------------------------+-------------------------
Comment (by colinleroy):
Replying to [comment:111 swissspidy]:
Hi,
> The latter turned out to be the most promising approach and now we want
to test it at a wider scale using a dedicated plugin, appropriately named
[https://wordpress.org/plugins/performant-translations/ Performant
Translations].
Thanks for working on this. I have given Performant Translations a look
and it's promising. (I'm the author of Native Gettext and I'd love to be
able to drop it).
However, profiling shows that Performant translations is still much more
CPU-intensive than Native Gettext is. On a reference page, I get
- 78M cycles in mo.php
- 21M cycles in Performant Translations' translatable-object.php
- 3.5M cycles in NativeGettext's class-native-mo.php (it does count cycles
spent in the native PHP extension)
I think Performant Translations is much better than what actually exists
in the core, and should replace the existing core's translation system.
But I also think it is not fast enough, and as each cycle is energy, it is
our responsability as web developers working on The Engine That Powers 40%
of the internet to do the best we can. This inefficiency probably
translates to terawatts-hour.
Reference profiles available at (I couldn't find how to attach files):
https://colino.net/tmp/no-translation-plugin.cachegrind
https://colino.net/tmp/performant-translations.cachegrind
https://colino.net/tmp/native-gettext.cachegrind
Hope this helps!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/17268#comment:112>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list