Jump to content

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


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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.