php speed compared to C++ cgi

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul.Lee.1971

    php speed compared to C++ cgi

    Hi,
    I'm designing an application that will allow users to interrogate a
    Mysql database, using some form of regex. The database will be fairly
    big, and I'm wondering whether using pre-compiled C++ cgi or php will
    be faster?

    TIA

    Paul
    --


  • Paul.Lee.1971

    #2
    Re: php speed compared to C++ cgi

    On 28 Jun, 23:11, "Paul.Lee.1 971" <Paul.Lee.1...@ googlemail.com>
    wrote:
    Hi,
    I'm designing an application that will allow users to interrogate a
    Mysql database, using some form of regex. The database will be fairly
    big, and I'm wondering whether using pre-compiled C++ cgi or php will
    be faster?
    >
    TIA
    >
    Paul
    --http://www.paullee.com

    By the way, when I say "applicatio n", I should have said webpage of
    course.

    Comment

    • ZeldorBlat

      #3
      Re: php speed compared to C++ cgi

      On Jun 28, 6:11 pm, "Paul.Lee.1 971" <Paul.Lee.1...@ googlemail.com>
      wrote:
      Hi,
      I'm designing an application that will allow users to interrogate a
      Mysql database, using some form of regex. The database will be fairly
      big, and I'm wondering whether using pre-compiled C++ cgi or php will
      be faster?
      >
      TIA
      >
      Paul
      --http://www.paullee.com
      It probably won't make any noticeable difference. The performance of
      the application will most likely be bound to the performance of the
      database anyway.

      If I had to pick/guess, I would have to assume the C++ cgi will be
      faster. As I said before, though, the difference won't be noticeable.

      Comment

      • Jerry Stuckle

        #4
        Re: php speed compared to C++ cgi

        Paul.Lee.1971 wrote:
        Hi,
        I'm designing an application that will allow users to interrogate a
        Mysql database, using some form of regex. The database will be fairly
        big, and I'm wondering whether using pre-compiled C++ cgi or php will
        be faster?
        >
        TIA
        >
        Paul
        --

        >
        It doesn't depend on the database query - it depends on what you're
        doing other than the query.

        Generally, C/C++ is faster in doing the same work, because it is
        compiled. PHP has to be interpreted.

        However, if you're running C/C++ as a CGI, you'll have overhead of
        loading the CGI. Of course, if PHP is running as a CGI, the same will
        be true. But if it's running as an Apache extension you'll have less
        overhead. But this loading time is very small, and can generally be
        ignored.

        The bottom line here is - have you ever heard of "premature
        optimization"? That's what you've got here. You're trying to optimize
        something when you don't know you have a problem.

        I really doubt it will be a problem either way, unless you're doing some
        really heavy CPU work outside of your database query.


        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • Tim Roberts

          #5
          Re: php speed compared to C++ cgi

          Jerry Stuckle <jstucklex@attg lobal.netwrote:
          >
          >Paul.Lee.197 1 wrote:
          >>
          >I'm designing an application that will allow users to interrogate a
          >Mysql database, using some form of regex. The database will be fairly
          >big, and I'm wondering whether using pre-compiled C++ cgi or php will
          >be faster?
          >
          >It doesn't depend on the database query - it depends on what you're
          >doing other than the query.
          >
          >Generally, C/C++ is faster in doing the same work, because it is
          >compiled. PHP has to be interpreted.
          >...
          >The bottom line here is - have you ever heard of "premature
          >optimization "? That's what you've got here. You're trying to optimize
          >something when you don't know you have a problem.
          Exactly right. I'd also like to point out that writing a CGI handler in C
          or C++ is a pain, as is doing MySQL work. There is a huge benefit in doing
          "phase 1" in PHP, getting something working relatively quickly, and then
          deciding whether or not it is "fast enough".
          --
          Tim Roberts, timr@probo.com
          Providenza & Boekelheide, Inc.

          Comment

          • Andrew Hutchings

            #6
            Re: php speed compared to C++ cgi

            Paul.Lee.1971 wrote:
            Hi,
            I'm designing an application that will allow users to interrogate a
            Mysql database, using some form of regex. The database will be fairly
            big, and I'm wondering whether using pre-compiled C++ cgi or php will
            be faster?
            Pre-compiled C++ will be a lot faster, especially if there is
            post-processing involved and pre-compiled PHP, and much much faster than
            un-compiled PHP. But in general it will be much quicker to code in PHP.

            --
            Andrew Hutchings - LinuxJedi - http://www.linuxjedi.co.uk/
            Windows is the path to the darkside...Wind ows leads to Blue Screen. Blue
            Screen leads to downtime. Downtime leads to suffering...I sense much
            Windows in you...

            Comment

            • Paul.Lee.1971

              #7
              Re: php speed compared to C++ cgi

              On 29 Jun, 09:49, Andrew Hutchings <i...@a-wing.co.ukwrote :
              Paul.Lee.1971 wrote:
              Hi,
              I'm designing an application that will allow users to interrogate a
              Mysql database, using some form of regex. The database will be fairly
              big, and I'm wondering whether using pre-compiled C++ cgi or php will
              be faster?
              >
              Pre-compiled C++ will be a lot faster, especially if there is
              post-processing involved and pre-compiled PHP, and much much faster than
              un-compiled PHP. But in general it will be much quicker to code in PHP.
              >
              --
              Andrew Hutchings - LinuxJedi -http://www.linuxjedi.c o.uk/
              Windows is the path to the darkside...Wind ows leads to Blue Screen. Blue
              Screen leads to downtime. Downtime leads to suffering...I sense much
              Windows in you...
              Thanks everyone, I really appreciate your advice. It looks like C++
              will be faster, but looking at the simply examples (on Informit.com)
              it seems to add unnecessary complexity. Anyway, thanks again

              Paul
              --


              Comment

              Working...