[PATCH] small speedup in DB::ifx::fetchInto()
| From: | Roman Neuhauser | Date: | Fri, 06 Jun 2003 19:51:10 +0000 |
| Subject: | [PATCH] small speedup in DB::ifx::fetchInto() | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-17128@lists.php.net to get a copy of this message | ||
since array_values() is much faster than transforming an associative
array into an ordered one with foreach(), and preserves the key order,
there's no reason not to use it.
--
If you cc me or remove the list(s) completely I'll most likely ignore
your message. see http://www.eyrie.org./~eagle/faqs/questions.html
Index: DB/DB/ifx.php =================================================================== RCS file: /repository/pear/DB/DB/ifx.php,v retrieving revision 1.9 diff -u -u -r1.9 ifx.php --- DB/DB/ifx.php 7 May 2003 16:58:28 -0000 1.9 +++ DB/DB/ifx.php 6 Jun 2003 19:45:12 -0000 @@ -225,12 +225,7 @@ return null; } if ($fetchmode !== DB_FETCHMODE_ASSOC) { - $i=0; - $order = array(); - foreach ($row as $key => $val) { - $order[$i++] = $val; - } - $row = $order; + $row = array_values($row); } return DB_OK; }
Index: DB/DB/ifx.php =================================================================== RCS file: /repository/pear/DB/DB/ifx.php,v retrieving revision 1.9 diff -u -u -r1.9 ifx.php --- DB/DB/ifx.php 7 May 2003 16:58:28 -0000 1.9 +++ DB/DB/ifx.php 6 Jun 2003 19:45:12 -0000 @@ -225,12 +225,7 @@ return null; } if ($fetchmode !== DB_FETCHMODE_ASSOC) { - $i=0; - $order = array(); - foreach ($row as $key => $val) { - $order[$i++] = $val; - } - $row = $order; + $row = array_values($row); } return DB_OK; }