Jump to content

Will including classes with out initializing them slow down processing time?


WolfRage

Recommended Posts

I want to know if I am using some OOP techniques, and I include some extra classes. These classes are rarely used but dynamically activate based on set parameters. Will the inclusion of the scripts slow down the time for PHP to process a request or will it simply ignore the files unless the classes are initialized. How does the difference in time compare to not including the files at all?

OK. I am using include_once() does this have a larger impact because PHP has to check to see if the script has already been called? How much of a hit?

I was attempting shorten my code as much as possible, but I think using switch statements or if statements to include the classes may provide better performance.

Perhaps I should set up some timing scenarios and figure this out on my own. But I am wondering if some one has already done the work?

Thanks for the autoloader, I think this is exactly what I am looking for. I have also found several other good articles on different performance topics since posting the question.

But I guess my one question that is unanswered is: I have heard that PHP jumps around in the code executing as is needed and leaving out the rest, that is why several classes can be included yet still execute with lightening speed; is this true?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.