Relgion: PHP vs Java.

May 9, 2007

Which programming language to use is often a matter of religious choice. But for certain tasks certain languages are much better than others. For example when it comes to creating web applications PHP can claim to be much superior to most yet when it comes to number crunching PHP lags far behind.

In the past, the perception was that Java isn't suited for number crunching tasks either. Those days are long gone. My java implementation of the Sieve of Eratosthenes to find prime numbers runs much much faster than the PHP counter part. The java version can find primes smaller than 1,000,000 in about 3 seconds while the PHP version takes more than a minute. That's a difference of 20X.

The same algorithm was implemented as a MySQl stored procedure so that the numbers are available in a form that can be easily searched. That code takes around 4 minutes to find the same set of primes. So clearly for this particular purpose Java is far superior to others. However if you compared against Fortran you will find that java is inferior.

See also : Object Oriented PHP vs java
Religion: JSP vs PHP

Posted by raditha at May 9, 2007 4:29 AM
Your Ad Here

 

Jabber  |  Linux  |  mySQL  |  PHP  |  Java  |  Site Map  |  Wiki

Downloads  |  About  |  Links  |  Contact  |  Home

 

Copyright © Raditha Dissanayake 2003 - 2007

Terms of Use  |  Privacy

 

 

May 2007
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31