ideffects Posted February 10, 2010 Share Posted February 10, 2010 Hey everyone, I'm working on completing a large website and I am monitoring the processing time for them since there is a lot going on. The website includes a lot of files and some of the pages generate a lot of HTML. There was one page that has 600 lines of code and the processing time was much higher than any other page (.5+ seconds vs .007ish). I figured there was a problem with one of the many loops or something going on. On further examination, I noticed that as long as I did not include one random file that outputs HTML, the load time goes to normal. Looking at it even further, I was able to randomly remove about 15 lines of HTML and suddenly the load time drops. So it seems like I hit some invisible wall that does not alter or stops processing the page BUT it takes a disproportional amount of time to process. I did a character count to see how many characters it takes and the magic number is 40182. I updated my version of PHP to 5.3.1 (from 5.2.11). I am wondering if someone knows anything about this and if there is a simple option that needs to be changes(doubt it) and if anyone can test it. I made a simple script to cause the problem. If you copy and paste it, it should work. <?php $time_start = microtime ( true ); $i = 1; while ( $i < 486 ) { $i ++; $q = "<p>This is line number $i. Lets see how many to make this script run slow...</p> "; echo "$q"; } echo "This is line is filler to see wha"; //This makes 40182 characters $time_end = microtime ( true ); $time = round ( $time_end - $time_start, 3 ); echo "<p>Process Time: $time seconds</p>"; ?> When I run the above, it takes about .5 seconds. If I change the while statement to 485, the problem goes away or even remove the "a" at the end of the line that reads echo "This is line is filler to see wha"; and the process time is .0001. Let me know what you think and if it happens to you. Quote Link to comment https://forums.phpfreaks.com/topic/191588-php-html-output-processing-time-legnth-not-proporitonal/ Share on other sites More sharing options...
teamatomic Posted February 10, 2010 Share Posted February 10, 2010 486=Process Time: 0.002 seconds 972=Process Time: 0.011 seconds 1944=Process Time: 0.014 seconds 4860=Process Time: 0.027 seconds Better look elsewhere for your problem. HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/191588-php-html-output-processing-time-legnth-not-proporitonal/#findComment-1009946 Share on other sites More sharing options...
PFMaBiSmAd Posted February 10, 2010 Share Posted February 10, 2010 What does a phpinfo() statement show for the output_buffering setting? Quote Link to comment https://forums.phpfreaks.com/topic/191588-php-html-output-processing-time-legnth-not-proporitonal/#findComment-1009993 Share on other sites More sharing options...
ideffects Posted February 10, 2010 Author Share Posted February 10, 2010 The output buffer is set to off. If I turn it on(4096), the page loads once slowly and then loads quickly since it is in the buffer. I would rather not keep the output buffer on. Any other suggestions. Quote Link to comment https://forums.phpfreaks.com/topic/191588-php-html-output-processing-time-legnth-not-proporitonal/#findComment-1010262 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.