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.
| [reply] [Watch: Dir/Any] |
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
| [reply] [Watch: Dir/Any] |
| [reply] [Watch: Dir/Any] |
The "Programming Republic of Perl" logo on that page is serious fun.
When you're finished with your pasty-hands little coffee-break and you've got serious work to do ... Perl has callouses on its hands.
| [reply] [Watch: Dir/Any] |
Subjective comparisons, or broad-brushed ones like “X is slower than Y,” simply use too broad and too vague of a brush. A programming language is a tool, and each of them is designed by someone with something-in-particular in mind. Thus, each language champions certain things at the expense of certain others, just as a wrench is not-so-good for driving a nail although it can be done. “Versus” comparisons frankly aren’t worth much in practice.
“Speed,” especially in a modern-day program, has mostly to do with algorithm. Which is why, in the tiny but important book, “The Elements of Programming Style,” we read this maxim: Don’t “diddle” a program to make it faster: find a better algorithm.”
But “speed” also has to do with how rapidly a particular set of programmers can accomplish the work, reliably and completely, and how well their work-product will integrate with everything else that surrounds it. Which is why, say, if you’re writing a program for the Android, you’re probably gonna do it in Java.
| [reply] [Watch: Dir/Any] |
:) your username is dicty, you know how to find FAQ :D
Thanks, I'm here all week
| [reply] [Watch: Dir/Any] |
I'm a biologist. Dicty is an organism that I studied before. :)
| [reply] [Watch: Dir/Any] |