[wp-trac] [WordPress Trac] #31182: array_shift in taxonomy.php very slow on large array

WordPress Trac noreply at wordpress.org
Fri Feb 6 06:39:52 UTC 2015


#31182: array_shift in taxonomy.php very slow on large array
--------------------------+------------------
 Reporter:  VolodymyrC    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.2
Component:  Taxonomy      |     Version:  2.7
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------
Changes (by bswatson):

 * keywords:  needs-patch => has-patch


Comment:

 Diff attached that changes

 {{{
 while ( $term = array_shift( $terms ) ) {
 }}}

 to

 {{{
 foreach ( $terms as $term ) {
 }}}

 Looping through via a do-while just seemed more complex and didn't add any
 benefit since the array is overwritten a few lines later.  I also removed
 the reset just before the block as it's no longer needed if we aren't
 depending on the array pointer.

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


More information about the wp-trac mailing list