Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Performance and require / include

0 views
Skip to first unread message

Infoman: Thorsten Koch

unread,
Jul 18, 2003, 9:49:21 AM7/18/03
to php-g...@lists.php.net
Hello List,

i have a question about the require / include functions and performance.

I try to divide my application into several files (e.g. templates and common config files) and they are included with the require statement. But is this really good for the performance? With only one
user on the webserver it doesn´t look like a problem. But what about 10 or 100 at the same time? Or even more?

I made a test, i included 9 files (in different directories) with variable definitions and functions and it took 0.087 seconds. then i wrote all the content from these 9 files to only one file and it
took 0.0005 seconds to execute.

Could this be a bottle neck, when more users access the application? What do you think? Are there other ideas to scale/devide my application?

Greetings from germany

Thorsten Koch

Curt Zirzow

unread,
Jul 18, 2003, 7:57:16 PM7/18/03
to php-g...@lists.php.net
Infoman: Thorsten Koch <ko...@infoman.de> wrote:
> Hello List,
>
> i have a question about the require / include functions and
> performance.
>
> I try to divide my application into several files (e.g. templates and
> common config files) and they are included with the require statement.
> But is this really good for the performance? With only one user on the
> webserver it doesn´t look like a problem. But what about 10 or 100 at
> the same time? Or even more?
>

It depends on the type of application your making. Now if you have a lot
of code that you include based on different conditions then that the
performance hit on having php hit the hard disk to read a small file
into memory.

for instance in some classes i have written, i have the methods,ones
that arn't used much and contain ~20+ lines of code, inlcude a seperate
file.
class test (
function used_alot() {
// code here
}
function not_used_much() {
include('test.not_used_much.php');
}
}


> I made a test, i included 9 files (in different directories) with
> variable definitions and functions and it took 0.087 seconds. then i
> wrote all the content from these 9 files to only one file and it took
> 0.0005 seconds to execute.

hm.. that seems odd. how many times did you do this? the second request
or repeated request should be faster in theory, the OS will most
likely keep those files cached in memory.

>
> Could this be a bottle neck, when more users access the application?
> What do you think? Are there other ideas to scale/devide my
> application?

I'm not an expert on these speed tests.. just my own opinion.


Curt
--

0 new messages