#includes: size versus number

Results 1 to 3 of 3

Thread: #includes: size versus number

  1. #1
    Branton Boehm Guest

    Default #includes: size versus number

    I&#039;ve got a bunch of functions... most of which aren&#039;t used on all of the pages on my site. But some (not always the same ones) are used on every page. Which would be better:<BR><BR>1.) Have one big file with all the functions and include it on each page; or<BR>2.) Break the functions down into their own files and only include the files when their function will be called on that page.<BR><BR>I&#039;m not sure how big of a cost including a large file is versus including multiple files of smaller sizes. Thanks for any insight.

  2. #2
    Join Date
    Dec 1969

    Default RE: #includes: size versus number

    I always try NOT to include anything I don&#039;t use in a particular page - but if development time is sort, using a single big include can speed things up a little. As long as it&#039;s not too big (one firm I used to work for had an include file of over 3000 lines of code. It included ALL administration functions - which was utterly pointless. talk about dumb)

  3. #3
    Join Date
    Dec 1969

    Default When it doesn't matter:

    If a page is "hot"...continually accessed...then the pre-compiled form of that page will stay cached in the server&#039;s memory. And so, realistically, it doesn&#039;t matter much whether you use lots of small includes or not. The includes happen only when the page is compiled, and once cached they have no impact on performance.<BR><BR>On the other hand, if a page is *not* hot, then it must be compiled. And then, yes, you take a small extra hit per included file. After all, Win32 can&#039;t open a file in zero time. <BR><BR>But now think about it: If the page isn&#039;t hot and doesn&#039;t stay hot, then do those extra few milliseconds matter? Once an hour or once a day, however often the page is dragged in to be compiled?<BR><BR>In short, I&#039;d go for maintainability of code--however you wish to define that for yourself--and not worry about it too much.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts