PHP performamce

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sanford Armstrong

    PHP performamce

    Hi,

    I'm new to PHP, but I'm loving its use so far. I have two pretty
    boring questions I can't seem to find the answer to:

    I have a template-driven site which uses PHP to drop in menu,
    content, etc. Most of the content is pure HTML, but there are
    a couple of special cases. To simplify my code, I'd like to
    change the extensions for all of my files from .html to .php.
    My question is this: will doing this slow my site down? Because
    then these files must be run through the PHP parser, even though
    there's nothing to parse.

    My second question is also pretty easy: when I do a require(), does
    that essentially copy and paste the require()'d file into the file
    which require()'d it? Basically, will I lose performance if I
    require() a .php file versus a .html file, assuming they are both
    pure HTML content?

    Thanks in advance,
    Sanford Armstrong
  • CountScubula

    #2
    Re: PHP performamce

    if you are serious about performance, don't parse a file that doesnt have to
    be. ie: pure html

    if you are looking for noticable speed differences on a small site with
    little traffic, you probably won't see a differnce

    --
    Mike Bradley
    http://www.gzentools.com -- free online php tools
    "Sanford Armstrong" <sanfordarmstro ng@email.com> wrote in message
    news:TYcTb.1506 8$QJ3.13526@fed 1read04...[color=blue]
    > Hi,
    >
    > I'm new to PHP, but I'm loving its use so far. I have two pretty
    > boring questions I can't seem to find the answer to:
    >
    > I have a template-driven site which uses PHP to drop in menu,
    > content, etc. Most of the content is pure HTML, but there are
    > a couple of special cases. To simplify my code, I'd like to
    > change the extensions for all of my files from .html to .php.
    > My question is this: will doing this slow my site down? Because
    > then these files must be run through the PHP parser, even though
    > there's nothing to parse.
    >
    > My second question is also pretty easy: when I do a require(), does
    > that essentially copy and paste the require()'d file into the file
    > which require()'d it? Basically, will I lose performance if I
    > require() a .php file versus a .html file, assuming they are both
    > pure HTML content?
    >
    > Thanks in advance,
    > Sanford Armstrong[/color]


    Comment

    • Sanford Armstrong

      #3
      Re: PHP performamce

      Yeah, it's a pretty small site for a local non-profit. We're talking
      files that average 5KB-10KB. I just don't want to slow the site down or
      put unnecessary strain on the server. I guess I'll just have to test it
      out and see if there's any noticable difference. Thanks!

      -Sanford

      CountScubula wrote:
      [color=blue]
      > if you are serious about performance, don't parse a file that doesnt have to
      > be. ie: pure html
      >
      > if you are looking for noticable speed differences on a small site with
      > little traffic, you probably won't see a differnce
      >[/color]

      <snip sig>
      [color=blue]
      > "Sanford Armstrong" <sanfordarmstro ng@email.com> wrote in message
      > news:TYcTb.1506 8$QJ3.13526@fed 1read04...
      >[color=green]
      >>Hi,
      >>
      >>I'm new to PHP, but I'm loving its use so far. I have two pretty
      >>boring questions I can't seem to find the answer to:
      >>
      >>I have a template-driven site which uses PHP to drop in menu,
      >>content, etc. Most of the content is pure HTML, but there are
      >>a couple of special cases. To simplify my code, I'd like to
      >>change the extensions for all of my files from .html to .php.
      >>My question is this: will doing this slow my site down? Because
      >>then these files must be run through the PHP parser, even though
      >>there's nothing to parse.
      >>
      >>My second question is also pretty easy: when I do a require(), does
      >>that essentially copy and paste the require()'d file into the file
      >>which require()'d it? Basically, will I lose performance if I
      >>require() a .php file versus a .html file, assuming they are both
      >>pure HTML content?[/color][/color]

      Comment

      • Chung Leong

        #4
        Re: PHP performamce

        If PHP is set up to run as a module, then no, it wouldn't slow the site
        down, as PHP can parse the file far faster can the Internet can transfer the
        data. If you're running PHP as CGI, then yes, your site would slow down,
        especially if the OS is Windows.

        Requiring a file is almost the same as copy-and-pasting the text into the
        script (the difference is in error reporting). If the file being included is
        plain HTML, you should use readfile() instead of require(), for the sake of
        semantic clarity. A declaration that the script requires something shouldn't
        cause something to occur (i.e. text output).

        Uzytkownik "Sanford Armstrong" <sanfordarmstro ng@email.com> napisal w
        wiadomosci news:TYcTb.1506 8$QJ3.13526@fed 1read04...[color=blue]
        > Hi,
        >
        > I'm new to PHP, but I'm loving its use so far. I have two pretty
        > boring questions I can't seem to find the answer to:
        >
        > I have a template-driven site which uses PHP to drop in menu,
        > content, etc. Most of the content is pure HTML, but there are
        > a couple of special cases. To simplify my code, I'd like to
        > change the extensions for all of my files from .html to .php.
        > My question is this: will doing this slow my site down? Because
        > then these files must be run through the PHP parser, even though
        > there's nothing to parse.
        >
        > My second question is also pretty easy: when I do a require(), does
        > that essentially copy and paste the require()'d file into the file
        > which require()'d it? Basically, will I lose performance if I
        > require() a .php file versus a .html file, assuming they are both
        > pure HTML content?
        >
        > Thanks in advance,
        > Sanford Armstrong[/color]


        Comment

        • Sanford Armstrong

          #5
          Re: PHP performamce

          The server is running Apache with pbp_mod, so I think I'm good. Thanks
          for the info!

          On a related note, would that mean that some PHP in a require()'d file
          can call a function declared in the require()ing file? I already see
          that variables in the require()ing file are available to the require()'d
          file.

          I'll read up on readfile(), thanks for the heads-up.

          Chung Leong wrote:[color=blue]
          > If PHP is set up to run as a module, then no, it wouldn't slow the site
          > down, as PHP can parse the file far faster can the Internet can transfer the
          > data. If you're running PHP as CGI, then yes, your site would slow down,
          > especially if the OS is Windows.
          >
          > Requiring a file is almost the same as copy-and-pasting the text into the
          > script (the difference is in error reporting). If the file being included is
          > plain HTML, you should use readfile() instead of require(), for the sake of
          > semantic clarity. A declaration that the script requires something shouldn't
          > cause something to occur (i.e. text output).
          >
          > Uzytkownik "Sanford Armstrong" <sanfordarmstro ng@email.com> napisal w
          > wiadomosci news:TYcTb.1506 8$QJ3.13526@fed 1read04...
          >[color=green]
          >>Hi,
          >>
          >>I'm new to PHP, but I'm loving its use so far. I have two pretty
          >>boring questions I can't seem to find the answer to:
          >>
          >>I have a template-driven site which uses PHP to drop in menu,
          >>content, etc. Most of the content is pure HTML, but there are
          >>a couple of special cases. To simplify my code, I'd like to
          >>change the extensions for all of my files from .html to .php.
          >>My question is this: will doing this slow my site down? Because
          >>then these files must be run through the PHP parser, even though
          >>there's nothing to parse.
          >>
          >>My second question is also pretty easy: when I do a require(), does
          >>that essentially copy and paste the require()'d file into the file
          >>which require()'d it? Basically, will I lose performance if I
          >>require() a .php file versus a .html file, assuming they are both
          >>pure HTML content?
          >>
          >>Thanks in advance,
          >>Sanford Armstrong[/color]
          >
          >
          >[/color]

          Comment

          • R. Rajesh Jeba Anbiah

            #6
            Re: PHP performamce

            [Top-post fixed. Don't top-post!.
            <http://www.wikipedia.o rg/wiki/Top-posting> ]


            "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message news:<kNKdnVxOy-Zl64DdRVn-uQ@comcast.com> ...[color=blue]
            >
            > Uzytkownik "Sanford Armstrong" <sanfordarmstro ng@email.com> napisal w
            > wiadomosci news:TYcTb.1506 8$QJ3.13526@fed 1read04...[color=green]
            > > Hi,
            > >
            > > I'm new to PHP, but I'm loving its use so far. I have two pretty
            > > boring questions I can't seem to find the answer to:
            > >
            > > I have a template-driven site which uses PHP to drop in menu,
            > > content, etc. Most of the content is pure HTML, but there are
            > > a couple of special cases. To simplify my code, I'd like to
            > > change the extensions for all of my files from .html to .php.
            > > My question is this: will doing this slow my site down? Because
            > > then these files must be run through the PHP parser, even though
            > > there's nothing to parse.
            > >
            > > My second question is also pretty easy: when I do a require(), does
            > > that essentially copy and paste the require()'d file into the file
            > > which require()'d it? Basically, will I lose performance if I
            > > require() a .php file versus a .html file, assuming they are both
            > > pure HTML content?[/color][/color]
            [color=blue]
            > If PHP is set up to run as a module, then no, it wouldn't slow the site
            > down, as PHP can parse the file far faster can the Internet can transfer the
            > data. If you're running PHP as CGI, then yes, your site would slow down,
            > especially if the OS is Windows.
            >
            > Requiring a file is almost the same as copy-and-pasting the text into the
            > script (the difference is in error reporting).[/color]

            <http://public.yahoo.co m/~radwin/talks/one-year-of-php-oscon2003_files/slide0081.htm>
            [Alert: Stop the page before it redirects to parent page]
            [color=blue]
            > If the file being included is
            > plain HTML, you should use readfile() instead of require(), for the sake of
            > semantic clarity. A declaration that the script requires something shouldn't
            > cause something to occur (i.e. text output).[/color]

            --
            "I don't believe in the God who doesn't give me food, but shows me
            heaven!" -- Swami Vivekanandha
            Email: rrjanbiah-at-Y!com

            Comment

            Working...