ID: 40261 User updated by: thuejk at gmail dot com Reported By: thuejk at gmail dot com Status: Closed Bug Type: Performance problem Operating System: All PHP Version: 5.2.0 Assigned To: dmitry New Comment:
Excellent, thanks :). I was irritated enough by this bug that I was thinking about implemented my own red-black balanced tree for the free list. Just curious, what did you do to fix it? I can't see any relevant messages at http://marc.info/?l=php-cvs&r=1&b=200703&w=2 in the near past. Previous Comments: ------------------------------------------------------------------------ [2007-03-20 06:49:08] [EMAIL PROTECTED] Fixed in CVS HEAD and PHP_5_2. ------------------------------------------------------------------------ [2007-03-16 13:57:21] bloire at citytoo dot com Real example ($a_output is a reference with 3000 results from mysql) The probleme processing with memory is after these differents solutions Time for processing Solution 1 or 2 is not verry different. The real probleme is after Solution 1 or 2 for all other processing with memory ! $a_input[idlg] = $a_context[idlg]; node::select_node_no_finalsite($a_input,$a_output); foreach ($a_output as $i => $a_row) { /* //Solution 1 : KO because verry verry verry SLOW $a_data[a_formulaire][listenode2][$i][idn] = $a_row[idn]; $a_data[a_formulaire][listenode2][$i][traduction_idn] = $a_row[traduction_idn]; $a_data[a_formulaire][listenode2][$i][traduction_idcat]= $a_row[traduction_idcat]; $a_data[a_formulaire][listenode2][$i][idte_idn] = $a_row[idte_idn]; $a_data[a_formulaire][listenode2][$i][idte_idcat] = $a_row[idte_idcat]; $a_data[a_formulaire][listenode2][$i][idcat] = $a_row[idcat]; $a_data[a_formulaire][listenode2][$i][name] = $a_row[name]; $a_data[a_formulaire][listenode2][$i][idsite] = $a_row[idsite]; */ //Solution 2 : OK :-) 15 milliseconds $a_data[a_formulaire][listenode2] = $a_row; } //Times here depends choice at top lines !!! //Times is 6518 milliseconds if solution 1 KO :-( //Times is 16 milliseconds if solution is 2 OK $instance_time=new time; $instance_time->execute("test","start"); for($i=0;$i<50000;$i++){ $a .= "k"; } //print $a; $instance_time->execute("test","stop"); print $instance_time->show(); Verry stange behavior for only 50000 concats !!!!!!!!!!! It's not normal because no probleme before php < 5.2 ------------------------------------------------------------------------ [2007-03-16 13:35:53] bloire at citytoo dot com My version is 5.2.1 the lastest with mandake limited edition 2005 and fedora core 4 The probleme exist always with php 5.2.1 !!!!!!!!!!! The latest release ! Probleme looks like : function test(&$b){ //sql Query... //$a_result_mysql //No problem with performance with php 5.2.1 (6 secondes) foreach($a_result_mysql as $i=> $a_row) { $b[artist][item][$i] = $a_row; } //Very very very very very very very very very slow with php 5.2 (180 secondes) //normal with php < 5.2 (10 secondes) foreach($a_result_mysql as $i=> $a_row) { $b[artist][item][$i][name] = $a_row[name]; $b[artist][item][$i][firstname] = $a_row[firstname]; $b[artist][item][$i][address] = $a_row[address]; $b[artist][item][$i][zip] = $a_row[name]; $b[artist][item][$i][color] = $a_row[color]; } } test($b); ------------------------------------------------------------------------ [2007-03-16 13:02:56] bloire at citytoo dot com I have exactly the same probleme with foreach with big rows from mysql and reaffection for each field for each row After that, all processing is verry verry verry VERRY slow. It's HORRIBLE. It's verry strange because I didn"t have this probleme with php < 5.2 I hope that will be repair because now, I'm not trusting with php 5.2 Thank you for all ------------------------------------------------------------------------ [2007-03-16 12:09:04] thuejk at gmail dot com I think I am hitting this in practice, or something like it. I have a function call <? function lala() { [database access with lots of data] echo "returning " . time(); return; } lala(); echo "returned ".time(); ?> And I can see that for some reason, the time between "returning" and "returned" is 60 seconds! This only happens the first time this function is called, for some reason. Installing php 5.1.6 it returns instantaneously. I liked thet PHP 5.1 memory allocator better :(. The PHP 5.1 memory allocator was also 1/4 the size of the PHP 5.2 memory allocator. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/40261 -- Edit this bug report at http://bugs.php.net/?id=40261&edit=1