[wp-trac] [WordPress Trac] #41305: Add lazily evaluated translations

WordPress Trac noreply at wordpress.org
Thu Jul 13 13:36:09 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
-------------------------+------------------------------
Changes (by schlessera):

 * keywords:   => has-patch


Comment:

 I've now uploaded an initial implementation, as well as a separate patch
 that replaces all translated strings in the REST API to make use of these
 lazy-loading proxies, as it think it should be relatively safe to do so
 for the REST API.

 This needed two small tweaks to the unit tests, where the tests were
 assert the actual internal type of `string` on error messages. I don't
 think that the probability is very high that actual code should hit that
 issue.

 This relatively conservative change reduced the wall time on my benchmarks
 (with 50 iterations) from 162ms to 152 ms, by eliminating 1236
 translations.

 Of course there's lots of other potential places where we can apply these
 optimizations as well. But I don't want to pollute this ticket too much.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41305#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list