Infoman: Thorsten Koch <[EMAIL PROTECTED]> 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
-- 


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

Reply via email to