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

WordPress Trac noreply at wordpress.org
Mon May 15 13:58:29 UTC 2023


#58317: Refactor determine_locale() for performance
-------------------------+-----------------------------
 Reporter:  Cybr         |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  I18N         |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  performance
-------------------------+-----------------------------

Comment (by SergeyBiryukov):

 Thanks for the ticket!

 Replying to [ticket:58317 Cybr]:
 > The first defense clause:
 > {{{#!php
 > <?PHP
 > if ( ! empty( $determined_locale ) && is_string( $determined_locale ) )
 {
 > }}}
 > Could become:
 > {{{#!php
 > <?PHP
 > if ( $determined_locale && is_string( $determined_locale ) ) {
 > }}}
 > Here, I removed a function call and a NOT operation, resulting in
 exactly the same code.

 I'm curious, could we have a benchmark for this particular change? The PHP
 manual entry for [https://www.php.net/manual/en/function.empty.php
 empty()] specifically states that it's a language construct, not a
 function.

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


More information about the wp-trac mailing list