Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Re: Re: Perl verus Java

by agentv (Friar)
on Oct 17, 2003 at 21:56 UTC ( [id://300186]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Perl verus Java
in thread Perl verus Java

...I'm not sure that either of these is valid. Each case will be different, and there's always the possibility that a different approach with either language (Java or Perl) will yield performance improvements that surpass the other.

To me, the difference between them is that of the answer to the question, "Which is better, Ford or Chevy?" If I have both, then I don't really care which is better (if there is an answer to the question at all). I can use the one that fits my needs in any given situation. The distinction between Perl and Java lies in the context. And I boil it down to this. If you want something built really quickly, and if you have one programmer working on it, then you probably want Perl. If you want something that will be built by a team of developers, and if the skill levels among them is disparate, you want the protection of a strongly typed, necessarily object-oriented language like Java.

A healthy IT shop would use both of them abundantly. But in most cases, the "surface dwellers" (Defined by me as meaning "those who don't actually code or test, but learn everything they know about IT from the industry rags and the in-flight magazines...) develop a jaundiced view of Perl from exposure to shoddy consultants, FUD-bearing industry sales drones, and jury-rigged benchmarks or anecdotal case studies.

Want to do the best thing for your career? Then learn both languages well, and be familiar with the performance implications of not only the languages you choose to implement, but of the services and protocols that are being used in the system that is being measured.

My first guess about the situation you describe is that the overhead that caused the Perl solution to be slow was imposed not by Perl, but by the communication protocol in use. You can usually count on the fact that JSP resources will execute and scale better than CGI. (Although this is not a universal truth.) So for instance, I could devise a test in which it could be shown that Java is dog-slow compared to Perl.

If you write a Java class file that contains a main() and serves the same role as a standard CGI program, it will absolutely poke along compared to the Perl counterpart. Java suffers from poor startup time latency due to the class-loader validation step that checks for bad code, and sometimes for security violations.

So most successful system implementations in Java will account for this by starting and loading classes early (ideally at server startup time in the .rc scripts) and then leaving them resident for when the demand occurs. I'll lay odds that this is the difference between the two approaches rather than the change of the programming language.

Or here's a pithier way to put it:

PHB: That's why we use Java instead of Perl.

You: No. You use Java instead of Perl because you know Java and you don't know Perl.

...All the world looks like -well- all the world, when your hammer is Perl.
---v

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://300186]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-19 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found