SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Jun 2004
    Location
    Montreal
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Performance question

    Hi,

    I am working on a huge site and need to include several file in some page (classes, function, header, footer, etc...).

    So I have 2 questions:

    1- Is there a limit number of include files?

    2- Is is better to include alot of small file (ex... one class per page) or one big file (with all classes) if sometime I may only need 1 class.

    Thank

  2. #2
    SitePoint Zealot
    Join Date
    Oct 2007
    Location
    In the blogosphere
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. No practical limit unless you feel like including a gazillion files
    2. Smaller files.

    I commonly have lots of files that are 'grouped' according to what classes I'd need often. (I have no idea if that makes sense to you)
    bLueFrogX's Blog - Random Ramblings of a NEET Techie ★

  3. #3
    SitePoint Evangelist praetor's Avatar
    Join Date
    Aug 2005
    Posts
    479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    About many smaller files: If you don't use a php accelerator you'll suffer a big performance hit. And depending on your files structure layout you might have to write quite a few of "require_once".

  4. #4
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I just put a single class in a file, and, in one file, require all of the class files.

    Then just require that file.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  5. #5
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I read somewhere about a performance benchmark regarding functions,

    Where the author wanted to see if having a bunch of functions that never get called affected performance - and he found out having thousands of functions but not ever calling 'em made very little performance difference.

    So going off that I would think that a single large file with alot of classes is more beneficial, but I've never seen any data regarding that.

  6. #6
    Grumpy Minimalist
    Join Date
    Jul 2006
    Location
    Ontario, Canada
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you're primarily using object oriented programming, consider registering an autoload function to prevent you from having to include files that you don't need.


Bookmarks

Posting Permissions

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