Java and PHP benchmarks

Java and PHP benchmarks … here is a solution to the problem.

Java and PHP benchmarks

I’m a PHP developer but recently had to write the same application twice, once in PHP and once in Java, because I was in school. Out of curiosity, I did a benchmark of both and found that the Java version was 2 to 20 times slower than the PHP version if the database was accessed, and 1 to 10 times slower without accessing the database. I see two immediate possibilities:

  1. I’m not good at Java.
  2. I can finally tell people to stop prompting php.

I posted my servlet code here. Or can anyone explain why Java feels like it’s bad?

I’ve always heard people say that Java is faster and scales better than PHP, especially my teacher, who was convinced, but the more requests, the slower Java becomes. PHP does not seem to be affected by the increase in load, but remains the same.

Related Problems and Solutions