[wp-trac] [WordPress Trac] #58317: Refactor determine_locale() for performance

WordPress Trac noreply at wordpress.org
Wed Jun 7 14:14:34 UTC 2023


#58317: Refactor determine_locale() for performance
--------------------------------------+--------------------------
 Reporter:  Cybr                      |       Owner:  swissspidy
     Type:  enhancement               |      Status:  reopened
 Priority:  normal                    |   Milestone:  6.3
Component:  I18N                      |     Version:  trunk
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+--------------------------

Comment (by Cybr):

 1. This ticket is meant to be educational and for me to see whether the
 WordPress ecosystem is ready to break barriers. If my 1.5~2.2x performance
 improvements are thrown aside because of obsolete coding standards, I see
 no reason to continue improving the software at
 [https://core.trac.wordpress.org/ticket/56541 more]
 [https://core.trac.wordpress.org/ticket/50568 impactful]
 [https://core.trac.wordpress.org/ticket/50567 places].
 2. It appears that this standard isn't consistently applied in WordPress.
 As of writing, 109 instances of `else if` are present in
 [https://github.com/WordPress/wordpress-develop WordPress/wordpress-
 develop's] first-party code.
 3. Breaking this barrier to allow short ternary syntax is imperative.
 WordPress will be held back with this restriction still in place. Short
 ternary can make the code more concise, readable, and often faster (less
 writing to variables, fewer jumps). It's a basic syntax that anyone can
 learn to apply and should be embraced. We can condense class `WP_Query` by
 at least a third if we start implementing this syntax.
 4. No, that can be written around at the expense of even more legibility
 if not using short ternary. But this is moot because of 5.
 5. No, the bug wasn't present before because the `! empty( $wp_lang )`
 check prevented that in a separate clause near the end.

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


More information about the wp-trac mailing list