costs of include, was Output_Cache Module

[email protected] (Ulf Wendel) Wed, 28 Feb 2001 12:09:51 +0100
Newsgroups php.pear
Message-ID <[email protected]>

Christian Stocker wrote:
> BTW, does anyone have any idea, how many lines of php-code justify a
> file-include? or better said, how many lines of php-code can php compile
> in the same time as it includes another file? strange question maybe and
> there's certainly not exact answer, but i believe to know, that
> file-access is rather expensive in cpu-cycles. but anyway, compiling
> php-code every time should be outdated today with all the caching-modules
> for the zend-engine, or am i wrong?

Well there's no easy answer to this. Generally speaking  you should try
to minimize the amount of files you include/require with PHP 4 as it
compiles all the files which takes some time. This optimization can by
done using include_once() / require_once(). 

I don't know the break eaven point where you notice the time zend needs
to compile the included source. It depends very much on your machine
and  it's load. The development server in my company is an old 167 Mhz
Ultra 1 with 256 MB. On this machine including libraries is quite a
problem as I get runtime profiles with a total of 0.8s where I have 0.6s
include and 0.2s for the content generation...

Second question: file accesses are not that expensive as the server
should have a disk cache.

Ulf