Relgion: PHP vs Java.

1178665148000 » Tagged as: religion

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

comments powered by Disqus