For those programs, the runtime is probably mostly determined by the IO speed (i.e. disk and network speed), since both perl and C++ should be able to do those tasks faster than the disk/network would be able to process it.

A local network connection, though, may be fast enough so that real processing time makes a difference.*

The big slowdown for perl CGI is the time it takes to load the interpreter and program code/modules, since CGI reloads everything for each request, but if your perl code is relatively small, and system load is low, disk caching etc may help bring down the load time if you run the same process repeatedly. (having a shared perllib instead of a static perl binary may help too, I guess).

If your perl program (including the modules it uses) is relatively large, or you've got a lot of requests to handle, using a system (like fastcgi) where you have the process (or multiple processes) running in a loop, handling one request after another without reloading is usually a great benefit, easily capable of increasing the performance 10 to 100 times. Especially since continual processes can make caching of (intermediate) processing a lot easier and faster.

* (update) AFAIK on linux at least, local (loopback) network connections can be shortcut - ignoring much of the network subsystem - that means they can be a lot faster than the maximum speed of the actual network system. In any case, I would guess that on many systems, a connection to localhost would not be dependent on the actual network hardware.


In reply to Re: performance questions regarding cgi & fastcgi with Perl and C++ by Joost
in thread performance questions regarding cgi & fastcgi with Perl and C++ by kingkongrevenge

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.