Ticket #452 (new task)
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
Note: See
TracTickets for help on using
tickets.

