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

WordPress Trac noreply at wordpress.org
Fri Jan 30 14:32:38 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:  needs-patch   |     Focuses:
--------------------------+------------------

Comment (by boonebgorges):

 `array_shift()` recalculates array indexes, which is why it's so slow on
 large arrays. See the first couple of comments here:
 http://php.net/manual/en/function.array-shift.php#86783 `array_pop()`
 would be fine. We could also use a `foreach` loop or even
 `wp_list_pluck()`, which became available only in 3.1.

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


More information about the wp-trac mailing list