in reply to perl or bash in cgi scripts?

Have you tried benchmarking your code?

Replies are listed 'Best First'.
Re^2: perl or bash in cgi scripts?
by morgon (Priest) on Jan 06, 2011 at 12:24 UTC
    But benchmark the right thing.

    We are talking about a cgi-script where you can assume that it will serve clients that are on another machine (probably even on another network).

    Even finding out that a bash-version is twice as fast as a perl-version it means nothing when the network-overhead is a thousend times bigger.

    So if you want to benchmark, benchmark not the scripts but the impact it has on clients receiving responses from your script.

    Using Perl gives you easy access to query-parameters (CGI.pm), a debugger and endless ways to make your cgi-script talk to other systems (a database maybe?).

    If you are doing cgi use Perl.

    If cgi is too slow use mod_perl.

    Don't ever use a shell-script for that sort of stuff - unless maybe as an excercise in software archeology to see how previous generations used to do things.

      Perhaps I'm misunderstanding the question, but it seems to me that AlfaProject has a CGI script written in Perl and has specifically asked if using Perl to open a file (and use LWP) is 'faster' than using unix commands to achieve the same thing. From what I read from your reply you seem to think that they asked a more general question, sort of like the post title, 'which is faster bsah or perl in CGI scripts'.

      Benchmarking the script will determine which is 'faster', performance testing a application/interface is different from benchmarking, as you suggest.

      Obviously there are other things to take into account, some of which would require much more detailed information in order to advise properly.