Ticket #452 (new task)

Opened 21 months ago

Last modified 11 months ago

Get rid of array_unshift whereever possible

Reported by: david Owned by: david
Priority: high Milestone: 1.0
Component: _OTHER_ Version:
Severity: trivial Keywords: performance
Cc: Patch attached:

Description

$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.

Attachments

Change History

Changed 11 months ago by david

  • priority changed from normal to high
  • severity changed from normal to trivial

Add/Change #452 (Get rid of array_unshift whereever possible)

Author



Action
as new
 
Note: See TracTickets for help on using tickets.