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

WordPress Trac noreply at wordpress.org
Mon May 15 15:00:37 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 needs-unit-tests  |     Focuses:  performance
----------------------------------------+-----------------------------

Comment (by Cybr):

 Here I have a benchmark in general for plain/empty/not/not-empty/isset
 /not-isset: https://3v4l.org/YvKIn.

 "Not empty" is consistently the worst performer, then "not isset," then
 "empty/not," then "not," then (the fastest) "plain." "Not empty" is about
 twice as slow as a "plain" boolean check.

 This is in line with [https://3v4l.org/Jha8v this benchmark], comparing
 the patch attached to this ticket versus to itself, where one has a "not-
 empty" `! empty( $determined_locale )`-check, and the other a "plain"
 boolean `$determined_locale`-check. This alone makes up for a 1.15x
 performance change.

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


More information about the wp-trac mailing list