On Wed, 2 Jan 2002, Agustin Rivera wrote: > Ok, the local Linux guru has proclaimed that C would be faster than Perl. I > know C is very effecient so I don't really doubt him, but my question is.... > would it make that much of a difference? I certainly wouldn't mind learning > C, the only question is would be worth the time to port our Perl scripts > over to it? Right now our setup is Apache w/modperl, and I'm getting quite > good at taking advantage of modperl's benefits.
The problem with C is that, while it is very fast, faster than Perl, your development time is going to increase as well -- C is very lousy as native string handling, and if you want to write CGI in C, you are going to have to either find a compiled library that already has all the work done for you, or struggle with your own CGI processing (both in handling CGI parameters and in printing out HTML). Kernighan & Pike, in their _Programming Paradigm_ book, go through an example of building a piece of software comparing C, Java, Perl and Tcl. C was by far the fastest, but also had the most lines. Perl was the second fastest, head and shoulders over Java, and also had the *least* amount of code. The program did some text processing, so it was obvious that this is where Perl shines. I don't think C is really going to gain you that much in CGI -- unless you are hooking into, say, an application server or some kind of realtime backend process, but then again, you can still write the CGI portion in Perl and use Inline::C or some of the other facilities Perl has for calling C code directly. C is definitely want you want to use if you are, say, writing kernel modules or intensely graphical games or anything that requires going down to the bare metal (like writing a device driver). But for web stuff, it seems more trouble than it is worth. -- Brett http://www.chapelperilous.net/ ------------------------------------------------------------------------ I am not afraid of tomorrow, for I have seen yesterday and I love today. -- William Allen White -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]