|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-11-01 22:26 UTC] sniper@php.net
[2005-11-01 23:13 UTC] starcitsura at shaw dot ca
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
Description: ------------ For some reason there is random lag when echoing the results. Now I say random lightly because there seems to be a tendency for certain items to be more likely to slow down then others, for instance at one point I ran the script about 10 times, and item six in the list always slowed down. The lag seemed to occur inside the part that echoed each image and link, at that time the lag would only occur on the image for the down button which makes even less sense. I used a micro time function that would echo the time since the last one was called. The lag seemed to occur during the html portion of the code., which doesn?t make much sense to me. What is causing this lag? I have also written the code so that it echo?s the html instead of the way its done now, there was no effect on the lag I wouldn't be worried about it if it was only like 15 milliseconds difference, but the lag varies anywhere from 100 ms to 1500ms which is not acceptable. Some time?s the list is as long as 100 items, in which case the items with lag are much more common, causing the script to take as long a 10000ms. I have tested this script on two different servers, the lag occurs on both. The main server uses PHP 4.3.11 Reproduce code: --------------- foreach($array as $value) { $conID = substr($value, 1); switch ($value{0}) { #simply choses which mysql query to run, then runs it } list($name,$built) = $data; $data = new entity($name); $cost = $data->fetchField('Cost'); ?> <li><?=$name;?> (<?=($cost-$built);?>/<?=$cost;?>) <a href="?LID=<?=$LID;?>&conID=<?=$value{0}.$conID;?>&shift=up" title="Up"> <img alt="Up" src="../../images/ingame/map/up.gif" height="11" width="11" /></a> <a href="?LID=<?=$LID;?>&conID=<?=$value{0}.$conID;?>&shift=x" title="Cancel"> <img alt="Cancel" src="../../images/ingame/map/x.gif" height="11" width="11" /></a> </li> <?php }