Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Perl and Java comparison

by wazoox (Prior)
on Feb 25, 2013 at 08:25 UTC ( #1020474=note: print w/ replies, xml ) Need Help??


in reply to Perl and Java comparison

It depends on your metric, because "faster" can mean different things. Perl is much terser than Java, and hasn't a static type system; therefore it's usually way faster to write the same program in Perl than Java. As programmer's time is way more expensive than computer time, this is usually a significant metric.

Now about execution time: most programs nowadays are IO-bound or network bound. If your program falls into this category, most languages (Java, C, Assembly, Perl, Python, ...) will perform similarly (i.e. none will be 10x faster than the other). Therefore you should choose the language you're the most comfortable with because none is actually much faster. But consider the first paragraph.

Last comes the case when your program is CPU-bound: by this metric, usually Java is faster than Perl. Java generally also provides easier or better tools to parallelize computations.

How do you know if your program is IO bound or CPU bound? if your programs reads vast amounts of data from the disk or network, than it's certainly IO-bound. If your program reads little data, than makes computation on it for hours, it's CPU-bound.


Comment on Re: Perl and Java comparison
Re^2: Perl and Java comparison
by tobyink (Abbot) on Feb 25, 2013 at 14:02 UTC

    In the programmer-time versus CPU-time comparison, it's useful to know how many times the program will be executed.

    If the program is a data munging routine that will be written, run once on the test database, and then once on the live database, then never used again, the programmer's time is probably a lot more precious than the execution time.

    But if the program is executed dozens of times each day, by hundreds of users, optimizing the run-time of the program, even at the expense of programmer time seems worthwhile.

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2014-10-23 17:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (126 votes), past polls