Comments -- Laggin up your script?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Comments -- Laggin up your script?

Post by nigma »

Hey, when you put comments in a PHP script will it make the script run slower?

I looked at the php homepage for some info on comments but didn't find what I was looking for.
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

From PHP.FAQTs:
If a PHP script is loaded heavily with comments, does the page load more slowly by Apache (to parse out the comments)?

Jan 22nd, 2002 08:54

Mårten Gustafsson, Ben Udall, Shelly Shaw


From a mail to php-dev by Andi Gutmans [2001-01-13]:
"As it is a compile first, execute later interpreter it will in
practice not slow down your code. Of course if your script has only a
very small amount of flat code (no loops/function calls) and a huge
amount of comments (tens of KB) then it could theoretically make a
difference but in reality it doesn't."
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Well duff, although I deserve to feel like a fool, I apreciate you responding without blatantly pointing it out. Thanks.
Post Reply