#452: Get rid of array_unshift whereever possible
---------------------+------------------------------------------------------
 Reporter:  david    |       Owner:  david      
     Type:  task     |      Status:  new        
 Priority:  normal   |   Milestone:  1.0        
Component:  _OTHER_  |     Version:             
 Severity:  normal   |    Keywords:  performance
---------------------+------------------------------------------------------
 {{{
 $t = microtime(true);

 $arr = array();
 for($i = 0; $i < 1000; $i++) {
    $arr[] = $i;
    //array_unshift($arr, $i);
 }

 $arr = array_reverse($arr);

 echo (microtime(true) - $t);
 }}}

 This takes 3ms, the {{{array_unshift}}} (without {{{array_reverse}}} then
 of course) takes 300ms. Maybe {{{array_shift}}} is equally slow.

-- 
Ticket URL: <http://trac.agavi.org/ticket/452>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5


_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets

Reply via email to