php memory question!
Quick question here:
Do you think i can lower my overall RAM usage if i only include the classes and functions on the pages i need the class/functions on?
For example, if i need the class "api.php" only on useapi.php, would i save/conserve memory by including it only on that page instead of globally in my header? Please let me know of the answer. :)
You sure would. The fewer symbols you need to use, the less memory it will use to run. This is why I've never recommended a single script to handle *every* custom function in use, rather split the scripts into logical groups of *what* the functions do. Classes are simply an extension on this same logic. Single script per class chained with namespace autoloading means I can limit the memory in use to just the required classes. Only downside is I sacrifice a bit of time since I don't explicitly issue an include/require and let the namespace resolution do its job instead. The time wasted is completely negligible, and IMO is well worth the flexibility by never issuing a require/include for my classes.
|All times are GMT +1. The time now is 03:14 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.