Php: how much is too much?

software development

#1

I’m developing a series of scripts containing common interfaces for certain tasks, such as a user-login, so that any page that requires a particular functionality can require() the appropriate files. So far I have been piling all the functions for a given task-set into one source file. The largest of these files is ~6kb in size, and could potentially double in size (or more) before I am done. (That is, 6kb of php source only.)

Essentially, I am wondering at what point will the file size start to bog down the PHP parser. Given that for each page served which includes a source file, the entire thing will be processed by the PHP parser before any source code is executed, I am concerned about slow load times, as well as grinding the cpu to a halt.

All this, of course, is speculation at this point. It may be that I am optimizing prematurely. However, I would appreciate feedback from anyone who has had an experience with a situation similar to mine.

Thanks much,
-Drew


#2

My website runs PHPBB, a free PHP based forum script. Every page you see when browsing through the forum (and every page on my site as it’s all tied into the forum itself) requires the loading, parsing and executing of at least 3 files containing 30KB or more of PHP scripts as well as several mySQL queries. Browsing the main forum areas requires 5 files averaging 40KB in size. These forums are rather ubiquitous and run fairly well.

Before my site gets any heavy usage I plan on firing up a 333mhz celeron machine, load up Linux, Apache, mySQL and PHP and do some testing. However…I don’t think you’ll ever have a problem with the size of the scripts you’re running. File size isn’t the only measure of script efficiency, but I’m sure any server you’re on can handle the memory requirements of a 12KB script :slight_smile: