Bug #3235: wasting many time in indexing operations in large loop
| From: | libes at com dot univ-mrs dot fr | Date: | Mon, 17 Jan 2000 15:19:34 +0000 |
| Subject: | Bug #3235: wasting many time in indexing operations in large loop | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-14716@lists.php.net to get a copy of this message | ||
From: libes@com.univ-mrs.fr
Operating system: linux redhat 6.0
PHP version: 3.0.12
PHP Bug Type: Performance problem
Bug description: wasting many time in indexing operations in large loop
hi to all and many thanks if you can tell me something...
we dump a little mysql database (90000 records) via php3-mysql
we write the records in an ascii file in order to get it via ftp
in a html frontend page we can select some buttons before the sql
query is launched.. these buttons are recuperated in the php code in a little loop where we compose
the name of the variables...
our problem is that we waste many many time (45sec) inside the main loop
(while $row) just to make the result line
/* $bouton=strtok($liste," ");
while($bouton) {
$ligne=$ligne.$row["$bouton"]."\t";
$bouton = strtok(" ");
}
*/
if we comment these lines (and we hardcode the composition of the result line) above we gain half
the total time
am i clear?
thanks if you have a solution? or maybe we touch the limit of the system?
ML
--------- to make a list of selected buttons---------
$liste="";
for ($k=1; $k<21; $k++)
{
$s="b".$k;
$long=strlen(${$s});
if ($long>0) {
$liste=$liste.${$s}." " ;
}
}
chop($liste);
--------to dump the selected colums--------
while ($row ) /*# 90000 records*/
{
/* $bouton=strtok($liste," ");
while($bouton) {
$uneligne=$uneligne.$row["$bouton"]."\t";
$bouton = strtok(" ");
}
*/
/* we gain many time if the above lines are comented ... why?*/
$uneligne=$row["Latitude"] ." ". $row["Longitude"] ."
". $row["Date"] ." ". $row["ProfMes"] ." ".
$row["Temp"] ." ". $row["Cond"] ." ".
$row["TempPot"] ." ". $row["Sal"] ." ".
$row["Sig0"] ." ". $row["Sig2"] ." ".
$row["Tur"] ." ". $row["Fluo"] ." ".
$row["O2d"]
. "\n" ;
$uneligne=$uneligne."\n";