Measuring performance of PHP

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

    #1

    Measuring performance of PHP

    I'm writing PHP Web sites that are database driven with mysql.

    I'm looking for ways to measure the performance (speed) of my php code, so
    that I can find ways to write the fastest php code. Any suggestions?

    Nick
  • Aggro

    #2
    Re: Measuring performance of PHP

    Mudge wrote:
    [color=blue]
    > I'm looking for ways to measure the performance (speed) of my php code, so
    > that I can find ways to write the fastest php code. Any suggestions?[/color]

    Use microtime() function at the beginning of your code and save the
    result into variable. Then do the same at the end and calculate the
    difference.

    Comment

    • Chung Leong

      #3
      Re: Measuring performance of PHP

      "Mudge" <mark1822@hotma il.com> wrote in message
      news:hklRc.2671 53$XM6.192050@a ttbi_s53...[color=blue]
      > I'm writing PHP Web sites that are database driven with mysql.
      >
      > I'm looking for ways to measure the performance (speed) of my php code, so
      > that I can find ways to write the fastest php code. Any suggestions?
      >
      > Nick[/color]

      Load up the database with lots of test data and run through the site with
      your browser. Perceived performance is what's important. After all, if an
      improvement can only be detected by a test tool, what is the point?


      Comment

      • Mike Peters

        #4
        Re: Measuring performance of PHP

        On 2004-08-08, Mudge wrote:[color=blue]
        > I'm writing PHP Web sites that are database driven with mysql.
        >
        > I'm looking for ways to measure the performance (speed) of my php code, so
        > that I can find ways to write the fastest php code. Any suggestions?
        >
        > Nick[/color]

        Check the PHP manual section for microtime, especially the example code
        and user comments:
        Return current Unix timestamp with microseconds


        --
        Mike Peters
        mike [-AT-] ice2o [-DOT-] com
        I am a DevOps and Cloud architecture consultant based in Northumberland in the UK. I provide consultancy on DevOps and private and public cloud solutions. I design and implement continous integration and continuous delivery solutions using Open Source, bespoke and commercial off the shelf software. I can also provide training and tuition for you or your team in DevOps best practices, tooling and solutions, OpenSource software, automation and cloud architecture solutions.

        Comment

        • steve

          #5
          Re: Measuring performance of PHP

          "Mudge" wrote:[color=blue]
          > I’m writing PHP Web sites that are database driven with mysql.
          >
          > I’m looking for ways to measure the performance (speed) of my
          > php code, so
          > that I can find ways to write the fastest php code. Any[/color]
          suggestions?[color=blue]
          >
          > Nick[/color]

          Use a PHP timing class. All done 4 u.


          --
          http://www.dbForumz.com/ This article was posted by author's request
          Articles individually checked for conformance to usenet standards
          Topic URL: http://www.dbForumz.com/PHP-Measurin...ict137571.html
          Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=459814

          Comment

          • Aggro

            #6
            Re: Measuring performance of PHP

            Chung Leong wrote:
            [color=blue]
            > Load up the database with lots of test data and run through the site with
            > your browser. Perceived performance is what's important. After all, if an
            > improvement can only be detected by a test tool, what is the point?[/color]

            Nothing if you have only one user. But if you got 10^X users, then wait
            time for each user will increase, because they have to wait for other
            viewers first.

            For example, if it takes 1 second for the php to do it all, and we have
            600 viewers. Assuming processor time will be shared equally for all,
            then they all have to wait 10 minutes before they can see the page. If
            time will be shared unequally, then first person might get the page in 1
            second, but the last one would have to wait 10 minutes.

            And now, if you can speed up the page into 0,5 seconds. Doesn't look
            much, but viewers will see the page 5 minutes faster assuming we have
            the same amount of viewers.

            Comment

            • Per Gustafsson

              #7
              Re: Measuring performance of PHP

              Mudge wrote:
              [color=blue]
              > I'm writing PHP Web sites that are database driven with mysql.
              >
              > I'm looking for ways to measure the performance (speed) of my php code, so
              > that I can find ways to write the fastest php code. Any suggestions?
              >
              > Nick[/color]

              I think you should check out the xdebug extension created by Derick Rethans,
              available at http://www.xdebug.org

              It's a great way to measure performance, and will help you debug your PHP apps.

              /p

              --

              Comment

              Working...