[wp-trac] [WordPress Trac] #41305: Add lazily evaluated translations
WordPress Trac
noreply at wordpress.org
Thu Jul 13 15:55:21 UTC 2017
#41305: Add lazily evaluated translations
-------------------------+------------------------------
Reporter: schlessera | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version: 4.8
Severity: normal | Resolution:
Keywords: has-patch | Focuses: performance
-------------------------+------------------------------
Comment (by jdgrimes):
Ultimately, I see the bigger underlying problem as being a design flaw in
many of the APIs where the translation functions are used. The ideal would
have been to design the code so that it did not have to worry about the
translations at all until it actually needed them. However, that is now
water under the bridge, and although we could take this into account when
designing future code, introducing these lazy functions is probably worth
the immediate performance gains.
A better design of the code to start with would likely also decrease
memory, whereas the lazy approach actually increases it overall in some
cases, although it appears that the memory increase is reasonably small
based on the numbers in the OP. I assume that memory consumption would
still be only minimally more than it presently is even if the lazy
functions were used by most plugins, but that might also be worth some
consideration and investigation. In cases where a text domain did not have
to be loaded at all (i.e., the translations were never actually used),
memory might actually be decreased.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41305#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list