SitePoint Sponsor

User Tag List

Page 3 of 3 FirstFirst 123
Results 51 to 59 of 59
  1. #51
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by firepages
    ...the first time I did tests on speed of includes etc (after seeing a thread such as this) I was amazed at the time spent loading files compared to actually parsing them , I was unaware (though I always assumed) there was a penalty, but not to the extent that I found.
    Do you have any results, code etc?

    I'd really like to nail this down once and for all. My position is that the cost of a single include is of the order of tens of thousandths of a second (on a slow-ish machine). You'd have to have an awful lot of includes before that becomes an issue.

    A simple if not very scientific test:

    PHP Code:
    /*
        test includes
    */
    function getmicrotime()
    {
        list(
    $usec$sec) = explode(" "microtime());
        return ((float)
    $usec + (float)$sec);
    }
    /*
        run this once to create some empty files for testing
    */
    mkdir('c:/includes_test'0755);
    for(
    $i=0$i<50$i++)
    {
        
    $fp fopen('c:/includes_test/file_' $i '.txt''wb');
        
    fclose($fp);
    }
    /*
        next, run this:
    */
    $start getMicroTime();
    for(
    $i=0$i<50$i++)
    {
        include(
    'c:/test/file_' $i '.txt');
    }
    echo 
    round(getmicrotime() - $start6) . '<br />';
    $start getMicroTime();
    include(
    'c:/test/file_1.txt');
    echo 
    round(getmicrotime() - $start6); 
    Quote Originally Posted by firepages
    It seems that many regular's in the advanced PHP forum seem to have one solution & that is to simply throw more hardware at a given issue , nothing wrong with that of course , but also nothing wrong with some basic optimisation.
    With good reason. The gains to be had from "optimising" php scripts tend not to be significant. Websites need to have a large amount of "headroom" to cope with max expected peak demand. If there really is a problem in the first place, gains of a few per cent from optimising scripts do not help. You need to upgrade the hardware.

  2. #52
    SitePoint Enthusiast
    Join Date
    Aug 2000
    Location
    Bay Area, CA; (Pasadena, CA this fall)
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The gains are crucial on a shared hosting server

  3. #53
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why?

  4. #54
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    Chicago
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by webhappy
    The gains are crucial on a shared hosting server
    No access to modify hardware.

  5. #55
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But you can always improve hardware by upgrading your account or getting a better host.

    If a site is struggling under peak demand small percentage speed increases (if you managed to get even that) would not really help.

  6. #56
    Non-Member
    Join Date
    Jan 2004
    Location
    Planet Earth
    Posts
    1,764
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  7. #57
    SitePoint Enthusiast
    Join Date
    Aug 2000
    Location
    Bay Area, CA; (Pasadena, CA this fall)
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    McGruff, what is the downside to this process? Nothing really... just extra deployment effort. Now, if we can find some other minor things to marginally improve the code, we might be able to keep the current shared host (which we might do for lots of reason such as cost).

  8. #58
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    California
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A new version was released of this allowing encoding of the freelock include... I just noticed this on the sf.net site.

  9. #59
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by webhappy
    McGruff, what is the downside to this process? Nothing really... just extra deployment effort.
    Yes.


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
  •