[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:18:00 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 jdgrimes):

 Just to confirm that `array_pop()` is faster:

 {{{
 $ php test.php
 array_pop takes 0.00221 seconds
 array_shift takes 5.69614 seconds
 array_reverse + array_pop takes 0.03113 seconds
 $ php -v
 PHP 5.5.10 (cli) (built: Mar 18 2014 18:10:23)
 Copyright (c) 1997-2014 The PHP Group
 Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
     with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
 }}}

 I've run into issues with this as well with large taxonomies.

 There are quite a few other places in core using `array_shift()`. Not all
 of these are subject to huge arrays, but I think they should probably be
 reviewed.

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


More information about the wp-trac mailing list