RE: [PHP] Size of Arrays
| From: | Chris W. Parker | Date: | Fri, 30 Jan 2004 20:54:01 +0000 |
| Subject: | RE: [PHP] Size of Arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-176397@lists.php.net to get a copy of this message | ||
Galen <mailto:phplist@zinkconsulting.com>
on Friday, January 30, 2004 12:35 PM said:
> On huge arrays (hundreds of thousands of elements, three dimensions,
> several megabytes) the performance impact is huge! The downside is
> you'll probably have to use numeric keys instead of associative, but
> for big arrays, numeric keys will probably also keep more memory free
> and improve performance a bit.
And here's another optimization (for the anal type).
$yCnt = -1;
$array_size = count($array);
while(++$yCnt < $array_size)
{
// do your stuff
}
Chris.