Includes eating up my time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PHP general list,

This is probably obvious to people who are good at PHP, but I'm

I have a PHP based CMS (content management system) built, which has grown and become quite robust. It's now spread out over about 30 files, and each file represents one class within the object oriented design. Each are a couple hundred lines of code, and two or three of the most critical classes are over a thousand lines of code.

While first building it, I didn't really anticipate quite that many files. What I did is have a file called "includes.php", which list all the files to be included. Then I in turn included "includes.php" at the beginning of my "index.php" file. Every page request passes through the "index.php" file, so that basically means every single file is included at the start of every new page request.

I'm using Zend Studio, which has a "profile" option, which shows how long it takes for my PHP scripts to complete a request. It has a breakdown showing percentages of which scripts are using that processing time.

Currently, my processes are taking under a second, but they can be around half a second or more. Although it all happens too fast for me to really notice as a person, it seems to me that a half second of processing time might be kind of long and lead to scalability problems.

My first question is: Is a half second too long? I'm pretty sure it is, but maybe I'm just being paranoid. What do people consider to be acceptable time frames for processing a web page similar to what Wikipedia delivers?

Most of the time is taken with the includes. Anywhere from 60% to 90% of the time it takes to process my scripts is coming from the includes.php file.

I read somewhere that it's not a good idea to have more than 10 includes in any one place. I'm fine with trying to break up my include requests, but I'm unsure as to how. As each function in each class passes around objects, it's not clear from looking at the code which ones are used at any one time, so I'm unsure how to efficiently include only the necessary classes.

My second question is: Is there a systematic way of determining how to incrementally include files that people use? Or is it just a constant process of testing and checking?

Thank you for any advice.

--
Dave M G
Ubuntu Feisty 7.04
Kernel 2.6.20-16-386

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux