Re: Pointers For Newbies, Reminders For Oldies
| From: | Rene Veerman | Date: | Wed, 27 Jan 2010 22:45:49 +0000 |
| Subject: | Re: Pointers For Newbies, Reminders For Oldies | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-301574@lists.php.net to get a copy of this message | ||
I'd like to add that when dealing with large memory structures,
usually arrays, combining them is fastest when done like this:
$array1 += $array2;
This will not always produce correct results when dealing with arrays
that contain identical keys, but for non-overlapping arrays it is far
faster than array_merge()
And if your script needs to pass large (> 5Mb) arrays around to
functions, be sure to use passing-by-reference; failing to do so can
double your memory requirements,
possibly hitting the ini_set('memory_lmit', ??)
$arr = array ( /* much data */ );
function workerFunc (&$data) {
//work on $data, as you would normally.
}
workerFunc (&$arr);