Possible Duplicate:
cost of “include” in PHP?
This question is specifically about PHP, but I'm pretty sure that he answer, in nature, is similar for most modern programming languages that support classes (at least interpreted ones).
When you include or use a class (using namespaces for PHP >= 5.3.0), how much processing resources are spent?
For example, imagine there's a big PHP script file Database.php
that has over a couple thousand lines of code, and you import it in another script:
# PHP >= 5.3.0
use Service\Database;
or
# in previous versions
include Service/Database.php;
I'm unsure of what happens behind the curtain in this case. Does it load all the class into working memory or just the functions you actually get to use? If you import it but don't use any of it, does it still waste resources?