Some languages are not tested on their strengths, but mostly on their weaknesses. Case in point: PHP. PHP is a fine web scripting language that provides a multitude of built-in convenience functions to simplify writing code for common CGI tasks. Since this shootout is a basic language test, and I don't have or plan to have any CGI scripting tests, the fact that PHP is somewhat slower in my tests than other scripting languages is hardly an argument against its use as a web scripting language.
Barry Andrews wrote:Hi,
I am beginning to learn some Perl, and I decided to do a little performance comparison between Java and Perl. I took an example from Sam's Teach Yourself (Listing 3.3) which is the classic 'print the primes' program, and I modified it to display the execution time. Then I made a few more changes so it would run as a Java program. To my surprise, Java was MUCH faster than Perl. In Java, to print out the first 100 prime numbers took only milliseconds, but the same program in Perl took 10 seconds. HUGE difference! I thought that Perl would be much faster, but I guess I was wrong. Can anyone provide some feedback on this? Here is the code for Perl:
And here is the listing for Java:
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Jimmy Clark wrote:To be concise, the application in this post written in Java may perform faster that the application written in Perl.
These are simple tasks and are not completely representative of how the technologies are used in the real world.
A better test would include complex string manipulations with pattern matching of 5 GB of records. Here most likely Perl would be faster.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |