I don't really know how servers works, but i've read somnewhere that the good thing about php is that it only takes time the first time -
so, I believe that the most requested scripts at a certain server (site) are LOADED permanently (untill some time out) thus requiring no file access.
We both need someoneelse to clear this one out.
- But I'm worried about something: you say thousands of lines, hundreds of classes?
If you have lots of classes and files and
ALL ARE NECESSARY
you must cut that down to
ALL ARE NECESSARY SOMETIMES.
reorganize them:
if you create both
class simple_object{}
and
class fully_functional_obj extends simple_obj{}
you can
include('all_small_classes.inc');
with a few mehods each
and then include only those extended_class.inc where you want to have it all...
- I've just downloaded this piece of code that makes it easier for you to track many included classes, and this is probably very usefull for you and me:
class ClassLoader{} !!!!
http://www.phpbuilder.com/tips/item.php?id=129
André
Will wrote:
Hi everybody, I need some suggestion on how to reduce the number of time a include file is read.
Here is the situation:
I have written multiple Classes, one class per file due to the large amount of functions. These classes are then included at the beginning of each php page.
Here is the problem:
combining the commonly included classes, there are a couple of thousand of line of code. If I read all these classes(all are necessary) at the beginning of each php page, that's alot of file access which would obviously close down the web page response time.
Is there a way I can load these class files into the memory once (maybe when the Apache server starts?)
I would really appreciate any suggestion on this.
-Will