1. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    Hmm i was just wondering..

    What processes faster ?
    one big php3-file or a few smaller ones ?

    Is there also a difference in cpu usage ?

    thnx in advance..
  2. #2
  3. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    As a matter of fact, I just finished some testing on this. I created a script with 60 conditional blocks consisting of 20 echo statements each, and set the conditions to execute 50 of them. In one version of the script, the code was all in one file. In the second version, each conditional block include()ed its 20 echo statements, each from a different file.

    I ran each script ten times through the time utility under FreeBSD Unix.

    0.987 real 0.112 user 0.007 sys

    1.138 real 0.106 user 0.007 sys

    It appears the inline method executes a little faster but uses more CPU time. Please note that this is not very thorough testing.

    Alan Little
    Holotech Web Design

  4. #3
  5. No Profile Picture
    rod k
    Devshed Newbie (0 - 499 posts)
    Makes sense. It would take fewer cycles as the interpreter only has to parse the actual files that get included, so using conditional includes saves on parse time. But it takes longer overall because you are doing more filesystem access.
  6. #4
  7. No Profile Picture
    Devshed Newbie (0 - 499 posts)

    How does php3 parse a file ?
    Is it realy parsing all functions or only
    the ones it needs ?

  8. #5
  9. No Profile Picture
    rod k
    Devshed Newbie (0 - 499 posts)
    I'm not sure what you mean by "all functions". It parses an entire script. However, if you conditionally include a script (ie. if(some_condition){include(file)} then the included file is only parsed if the condition is true. Whereas if you require() a file then it is added to the script before parsing and executing.

Similar Threads

  1. Replies: 12
    Last Post: February 19th, 2005, 11:40 AM
  2. Apache2.x and NamebasedVirtualHost
    By tcpip in forum Apache Development
    Replies: 1
    Last Post: November 20th, 2003, 04:37 PM
  3. Anyone found a sollution to scroll in NS6 with "Scrolling=no"?!?
    By Royverdiani in forum HTML Programming
    Replies: 2
    Last Post: May 18th, 2001, 10:24 PM

IMN logo majestic logo threadwatch logo seochat tools logo