Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

overheads with required core files 1

Status
Not open for further replies.

Microbe

Programmer
Oct 16, 2000
607
AU
Can someone tell me about overheads when including a file that contains a load of functions and classes.

If I require a "core" file that has a load of code in it at the top of every page, and much of the code may not be used in that page, am I adding any wasted overheads? Or if a class isn't substantiated or the function not used do they just sit there not wasting resources?

Hope that makes sense and appreciate any response.

Steve
- I have fun with telemarketers
 
there are processor cycles taken up in parsing the file, and memory taken up in storing the pointers to the functions, but as no object is instantiated against the class then there is no object that can take up memory.

 
SO it is good (and tidier) to cram everything into the core file and just call on functions/classes etc when needed, right?

Steve
- I have fun with telemarketers
 
i would not say that, no. the parsing takes a reasonable chunk of processor time.

i tend to have a bunch of library functions that get included at the initialisastion of the scripts. classes i store in different physical files (related class in the same files if they inherit - mostly) and then require() the files as and when they are needed. i try always to require/include within the global scope.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top