[wp-trac] [WordPress Trac] #61624: Cache translations

WordPress Trac noreply at wordpress.org
Thu Jul 11 21:06:06 UTC 2024


#61624: Cache translations
-------------------------------------------+------------------------------
 Reporter:  leonardola                     |       Owner:  (none)
     Type:  enhancement                    |      Status:  new
 Priority:  normal                         |   Milestone:  Awaiting Review
Component:  I18N                           |     Version:  trunk
 Severity:  normal                         |  Resolution:
 Keywords:  reporter-feedback needs-patch  |     Focuses:  performance
-------------------------------------------+------------------------------
Changes (by swissspidy):

 * keywords:  has-patch => reporter-feedback needs-patch


Comment:

 Hi there and welcome to WordPress Trac!

 Did you do any concrete profiling for this? I would love to see your data.

 The new translation system in 6.5+ is actually very lean and translating
 the same string multiple times doesn't cause any additional overhead (O(1)
 to access it from an array).
 What definitely can add overhead is applying all these filters every time.
 However, plugins rely on these, and suddenly not running the filters could
 be a backward compatibility break.

 Also, as you will have seen on GitHub, your PR breaks a lot of existing
 tests, so it's definitely not as straightforward as adding a simple
 caching variable. Not to mention that calling `determine_locale()` so
 often in a hot code path actually makes things slower.

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


More information about the wp-trac mailing list