Okay, time for me to step into the fray.

Here's how this works:

When a webserver (let's say Apache) gets a request from a client to run
a traditional CGI, the server spawns a new process *independent* of
itself. If the process is a Perl process, then it has the overhead of
initialization, reading in the file, parsing, etc. *before* it can do
anything useful to the end user.

If you have a servlet engine installed (say, Apache JServ), then when
the webserver gets a request for a servlet to be run, the server just
passes the request to the servlet engine *which is already running*,
which then passes the servlet info to the JVM *which is already running*
and the JVM spawns a Java thread on top of itself to handle the servlet
request. This all happens in very short order. If I recall correctly, an
ISP in San Francisco did some tests of Perl CGIs and Java servlets
side-by-side, both doing *exactly* the same things, and found that the
servlets ran on the order of 10 times faster than Perl, and produced a
significantly lower overhead on the server (I think the exact data are
on java.sun.com somewhere -that's where I first saw it about a year
ago). The reason for the difference? The servlets don't have to start a
new JVM process for each request, whereas Perl CGIs have to start a new
Perl process for each request. 

This is not to say that Perl isn't better suited for some tasks when you
restrict yourself *only* to the "core" Perl distribution.
Pattern-matching and other such niceties are truly wonderful builtins.
But if someone wants to use Java on their server, unless there is a very
compelling reason not to, I don't see any reason to try to convince them
otherwise.

By the way, java.sun.com is served from Java WebServer, and uses
servlets for almost everything, as does sun.com. So, before you dismiss
Java as a "toy", take a look at those two sites. You might be surprised
to see how much functionality is there, and how fast they serve.

John Goerzen wrote:
> 
> On Wed, Feb 17, 1999 at 01:17:43AM -0800, Steve Byrne wrote:
> 
> >  > But what techincal advantage do they really give?  Java is slower, uses more
> >  > system resources, etc.
> >
> > John, if you don't like Java, can you please tell us why you feel it's
> > necessary to clog this mailing list with your anti-Java sentiments?  I don't
> > think it's being constructive.
> 
> I am really getting annoyed with people picking out bits and pieces of what
> I wrote.  You, and others, are taking it out of context.
> 
> I have explained the areas in which I feel Java has an advantage over other
> languages -- for example, development of large-scale client GUIs.  I have
> also explained the areas in which I feel Java has some catching up to do,
> for example, tasks involving parsing.
> 
> If you feel that any particular language, including Java, is the best choice
> for every possible task, then you need to take a larger view of reality.
> The fact is that Java is not the best in all areas.  Likewise, Perl is not
> the best in all areas.  Neither is C.  For that matter, neither is Linux or
> Windows.
> 
> You use the tool that's right for the job.  I use Java for some things, Perl
> for some things, C for some, C++, shell scripting, etc.  All of them have
> their unique advantages and disadvantages.
> 
> You would probably think me crazy to use shell scripting for a GUI.  While
> technically possible, it would be horrendous code.  Likewise, I would
> probably think that using Java for an application that does a lot of
> complicated parsing of input, computation, and then generation of output
> would not be wise; Perl is better suited to that task.  Similarly, if I were
> writing a webserver or other server that could see high levels of load, C is
> really the only good choice.  Perl and Java may require less code, but the
> performance would not be the same simply because of the abstraction in order
> to make it system-independant -- although Perl is closer to Unix than Java.
> The interpretation cost and memory overhead hurts, too.
> 
> Constructive criticism is a well-known useful device.  If I point out to the
> Perl people that the lack of strong typing can make large projects
> difficult, and thus make Java a better tool for the job, perhaps the Perl
> people will consider adding typing to the language (and indeed, they are
> doing so).  Likewise, if I point out to Java people that Java's parsing
> capabilities are weak compared to Perl, perhaps they will add something to
> help with that.  In the end, everone wins, because all the languages
> improve.
> 
> I fail to see what's wrong with talking about Java's unique benefits and
> problems in a Java list.
> 
> John

-- 
Jeff Galyan
http://www.anamorphic.com
http://www.sun.com
jeffrey dot galyan at sun dot com
talisman at anamorphic dot com
Sun Certified Java(TM) Programmer
======================================================================
Linus Torvalds on Microsoft and software development:
"... if it's a hobby for me and a job for you, why are you doing such a
shoddy job of it?"

The views expressed herein do not necessarily reflect those of my
employer.

Sun Microsystems, Inc., has no connection to my involvement with the
Mozilla Organization.

Reply via email to