On 29 Apr 99, at 10:42, Ed Carp wrote:
> Not at all. It all depends on what you're looking for, and what your
> experience level is. If your site is going to get a lot of hits, C is the
> best tool, because it's the fastest.
Not necessarily. Sometimes the bottleneck is not in the code.
Also, if you imbed the perl interpreter into the web server then your
speed of execution is nearly the same. Add a persistent database
connection via a perl module and there is little difference in speed
If you have limited programming
> experience, PHP or PERL will perhaps fit your needs better, because it's
> more of a RAD tool than C is, but you trade off speed and flexibility. But
> no interpreted language will be faster than compiled native code, that's
> just common sense.
True, but your talking the web here. That means CGI. CGI itself is
inherently slow. If your writing code that uses the webservers own
API then you'll see a dramatic increase in speed. People write CGI
in perl is because of RAD as you mentioned above, portability of
code without tweaking or recompiling, it's most excellent regular
expression engine (web development mostly involves text parsing
not number crunching), and last but not least, it huge free library of
modules that give you the tools to do your job without reinventing
the wheel. Find me any C/C++ code the does what the DBI.pm
module does. My code will work with nearly any database backend
by changing one line of code. Find me any C/C++ code that comes
close to CGI.pm module.
> For example, I have a web page that uses MySQL to generate an index of
> news headlines and links. I wrote this in C, because it had to be fast -
> when you're searching a database of 24,000+ headlines, and have multiple
> people banging away at the server, it pays to make it as fast as possible,
> and the HTML was no harder to generate than it was in any other language.
> PHP or PERL would've been at least half as fast (I know because I
> benchmarked the same app written in C, PERL, and PHP).
If speed is important, perl allows you to imbed C/C++ code into
your perl modules. Just rewrite those parts where speed is
important and write the rest in perl where text manipulation/RE use
> There's a saying in certain programming circles that people who don't know
> how to program choose PERL or PHP, people who do choose C or C++, and I
> think there's a certain amount of truth in that. Why is MySQL qritten in
> C, rather than in PERL? It would've certainly been easier. Why is most
> system software written in C? Why is it that most every modern operating
> system is written in C or C++?
Again, we are talking web development. Perl is not the best tool for
everything (like building OS's, unless you wanted to write a OS
rapidly that will run on any platform ;-). There is another saying in
"certain" programming circles that there's more than one way to do
it (TMTOWTDI). People choose perl because it allows you to
quickly develop working programs without much programming
experience. People continue to choose perl because of all the
reasons mentioned above...
Take care of your shoes...