I ran my code through xdebug profiler and saw more than 30 percent of the time is spent on the require() calls. What is the best way to improve on this? I saw some posts a
You can improve speed of your code by using PHP compiler, like http://eaccelerator.net/.
Such compiler makes everything work faster, also including files.
Make sure your includes use absolute instead of relative paths. Easiest way to do this is by prepending your paths with
dirname(__FILE__) // for php < 5.3
__DIR__ // for php >= 5.3
APC and autoload had some problems once. That's a long time ago. In general, APC can speed up you require
statements, since it caches the parsed files. By default APC will still stat
the file to see if it has changed on disk. You can prevent this by using absolute paths and turning the apc.stat setting off. Note that this means that you have to restart the server to clear the cache.
The reason why requires consume time is disk IO speed. You can try using autoloading, as you may be requiring files that aren't actually used. Another approach to reduce the disk IO overhead is to combine your PHP files into one large file. Requiring a big file which contains the code you always need is faster than including the same code in multiple small files.
Also, APC has a feature which speeds up requires called apc.include_once_override which you can try enabling.
how many items are in your include path? and is the order of the locations sensible for your application? if you're using relative paths then it will check the include-path locations in order looking for a matching file.