php-judy icon indicating copy to clipboard operation
php-judy copied to clipboard

PHP Judy has limit?

Open markytrigger opened this issue 9 years ago • 0 comments

Judy is a good example on how to handle large array as it compressed as possible. When the server stops the process it means we are consuming almost at the peak of the memory so it force to kill the PIDs.

Now lets say the situation is this: length/count of $array1 is 100,000 and $array2 is also 100,000 then pair every values of $array1 and $array2 and every index has a value of multidimensional lets say $array1[0] = array(['members'] => array('mark', 'eric', 'joseph'), ['age'] => array(22,22,21) .........)

$this->result = new Judy(Judy::INT_TO_MIXED); $z = 0; for($i = 0, $count1 = count($array1); $i < $count1; $i++){ for(j = 0, $count2 = count($array2); $j < count2; $j++){ $result = array('from_array1' => $array1[$i], 'from_array2' => $array2[$j]); $this->result->offsetSet($z, $result); $z++; } } echo $this->result->count(); //expected 10B results

example of 200mb turns to 8mb is good. but when the variable holds gigs of data the RAM suffer in holding it temporary as the script is not finish. Sorry for my ignorance I maybe reach the limit of PHP but Im open to any suggestion. Or should the server adjust to cater my needs?

Local Server specs 8core 16gbram

markytrigger avatar Apr 23 '15 08:04 markytrigger