Author Topic: PHP HTML Output Processing Time Legnth Not Proporitonal  (Read 242 times)

0 Members and 1 Guest are viewing this topic.

Offline ideffectsTopic starter

  • Irregular
  • Posts: 2
    • View Profile
PHP HTML Output Processing Time Legnth Not Proporitonal
« on: February 10, 2010, 04:32:17 AM »
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);
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.

Offline teamatomic

  • Devotee
  • Posts: 1,197
  • Gender: Male
  • fat skis rule!
    • View Profile
    • myPHPtemplate
Re: PHP HTML Output Processing Time Legnth Not Proporitonal
« Reply #1 on: February 10, 2010, 04:51:55 AM »
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
when in doubt...ski fast
when scared...ski faster
when terrified...point em down

Offline PFMaBiSmAd

  • Guru
  • 'Insane!'
  • *
  • Posts: 14,588
  • In Coding, Automatic means you write code to do it
    • View Profile
Re: PHP HTML Output Processing Time Legnth Not Proporitonal
« Reply #2 on: February 10, 2010, 06:46:35 AM »
What does a phpinfo() statement show for the output_buffering setting?
Signature: (not a comment about anything you posted unless specifically indicated)
Debugging step #1: To get past the garbage-out equals garbage-in stage in your code, you must check that the inputs to your code are what you expect.

Programming is just problem solving, but it is done in another language. You must learn enough of the programming language you are using to be able to read and write code.

Offline ideffectsTopic starter

  • Irregular
  • Posts: 2
    • View Profile
Re: PHP HTML Output Processing Time Legnth Not Proporitonal
« Reply #3 on: February 10, 2010, 01:52:48 PM »
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.