I have some 1000 functions that are required in many scripts. Many functions are required by all scripts but not all functions are required in a script.
So I put these functions in a functions.php script and this file is included in the scripts.
If a script requires just one function from the functions.php will the other 999 load as well ? Will this be a memory issue ? If so then how do I avoid this ?
Thanks
Anjanesh
Including Function Script File - Memory Issue ?
Moderator: General Moderators
- dull1554
- Forum Regular
- Posts: 680
- Joined: Sat Nov 22, 2003 11:26 am
- Location: 42:21:35.359N, 76:02:20.688W
if im not mistaken they all will be loaded at ruintime, but its not outputted to the user so i dont think it will cause any issuses, but thats just my opinion
another soultion would be to break up your functions into individual files(functionName.txt) then just include the required ones, or build classes that contain clusters, like 50 functions but how you have it now i dont think will cause a problem.
another soultion would be to break up your functions into individual files(functionName.txt) then just include the required ones, or build classes that contain clusters, like 50 functions but how you have it now i dont think will cause a problem.
- Saethyr
- Forum Contributor
- Posts: 182
- Joined: Thu Sep 25, 2003 9:21 am
- Location: Wichita, Kansas USA
- Contact:
anjanesh,
I found it easier to create multiple files for example:
fncStrings.php
fncEmail.php
fncDb.php
etc..
This breaks my library into about 15 or 20 files and I only include what I need at that point, seems to me including a file with 1000 functions, which I am guessing is about 5k-15k lines of code would slow your applications to a crawl. Now I could be wrong on this, but it is just my opinion to only include what you need. Waste not want not
I found it easier to create multiple files for example:
fncStrings.php
fncEmail.php
fncDb.php
etc..
This breaks my library into about 15 or 20 files and I only include what I need at that point, seems to me including a file with 1000 functions, which I am guessing is about 5k-15k lines of code would slow your applications to a crawl. Now I could be wrong on this, but it is just my opinion to only include what you need. Waste not want not