Perl/PHP/Java compared yet again

ziggy on 2001-04-23T04:02:28

Erik Zoltán has written an article for IBM developerWorks comparing Perl, PHP and Java Servlets for server-side web development. As you would expect, Java makes easy things complicated, and PHP makes easy things easy with some loss of power. Perl, of course, just gets the job done. :-)


mod_perl

koschei on 2001-04-23T07:09:16

And, naturally, mod_perl doesn't get glanced at.

Someone needs to promote it a bit more, methinks.

Re:mod_perl

ziggy on 2001-04-23T07:20:14

In all fairness, this article started out with a simple "Hello, World!" CGI script. Speeding up a
Perl program consisting of little more than a single print statement doesn't require mod_perl.

Re:mod_perl

Falsch Freiheit on 2001-04-23T08:29:11

In all fairness, this article started out with a simple "Hello, World!" CGI script. Speeding up a Perl program consisting of little more than a single print statement doesn't require mod_perl.

I disagree.

Much of how a simple "Hello, World!" Perl CGI program takes up time to run is the startup time for the perl binary to load and the (probably quite small in this case) time to compile the program.

Sure, you're not gonna be waiting long for either of those to happen, but if you needed to run your "Hello, World!" program a million (or even only a hundred thousand) times a day, getting it to run under mod_perl would give you an astounding amount of optimization.

(quite probably it'd be faster than an equivelant program in C, simply because the C program would still need to be loaded by the OS every time)

confusion between language and architecture !

fauvelle on 2001-04-24T10:48:41

I think, strictly speaking, that you can't
compare 2 things if you allow a variation on
more than one critera at a time (this is
a very common scientific rule).

This article presents 3 languages, and 3
architectures, which should have been
compared separately.

As a matter of fact, you can Embed perl
into html a la PHP (using tools like ePerl, HTML::Embperl, Apache/ASP, Velocigen...),
you can write servlets with Perl like you do
with Java, and you could write CGI using Java.

-/JPF/-

Re:confusion between language and architecture !

koschei on 2001-04-24T11:12:20

In other words, it's one of the more completely useless articles to appear on the 'net. Right up there with the Big Red Button That Doesn't Do Anything.

Re:confusion between language and architecture !

pudge on 2001-04-24T13:04:42

I did not read the article closely, just skimmed it, but it didn't seem to look at performance of architectures at all, but focused on the language aspects. As such, I see no problem with leaving out mod_perl.

Re:mod_perl

ziggy on 2001-04-24T16:00:23

Much of how a simple "Hello, World!" Perl CGI program takes up time to run is the startup time for the perl binary to load and the (probably quite small in this case) time to compile the program.

It doesn't matter how quickly a program runs if it is incorrect. The first thing to do when learning a new language (e.g. Perl for CGI programming) is to take the first baby steps, such as "Hello, World!". After that, it's time to apply the optimizations, like mod_perl.

Premature optimization is the root of all evil in programming. -- C.A.R. Hoare

Re:confusion between language and architecture !

ziggy on 2001-04-24T16:10:59

This article presents 3 languages, and 3 architectures, which should have been compared separately.

By that logic, Java cannot be compared with anything except itself, because nothing else uses the Java Servlet architecture except Java (modulo Jython and TclBlend). The fact remains that there are a bazillion and one different ways to do dynamic pages on the web, and Perl/PHP/Java are frequent contenders in some way, shape or form. This article offers a cursory comparison to introduce three of the many possibilities, and shows Perl in a relatively nice light.

A more scientifically rigorous study would be about as thick as Camel III, and unread by the target audience -- beginners who can't make up their mind between Perl and something else.

Re:confusion between language and architecture !

$Bob on 2001-04-24T17:37:08

By that logic, Java cannot be compared with anything except itself, because nothing else uses the Java Servlet architecture except Java


A lot of architectures use something similar to the Java Servlet architecture, FastCGI is the most prominent but there are others. The only difference between the way FCGI does it and Servlets is the threading.