All of us know that Java on the server required JVM then it goes to machine code while php does not need this.
From this point of view, can we say that php will perform better on a server than Java??开发者_如何学JAVA
If Yes, by how much approx the resources used by java is more than the resources used byphp ?? is it 150% more or 110% more??
Java is a lot faster than PHP (5x-10x), but it is also more memory consuming(usually, but not always), approximately 2x. But my opinion depends on software applications i`ve seen. It is never true to say that Java is better than PHP in all ways and everywhere. In my work we use Java for heavy business applications (Tomcat 6 with Terracotta clustering), and PHP for small-medium sites and frontends.
I think you should still consider PHP, especially since more and more nice PHP compilers are starting to emerge.
From the beginning there were opcode cachers, like bcompiler or zend cahche, and they increased performance with 5x - 2x, but now there are things out there like http://developers.facebook.com/blog/post/358, more real compilers that seem to translate php code to lowlevel instructions, which must be almost as fast as a Java-equivalent. (A search on "php compiler" would get all the available options)
So php is not that bad anymore processor-wise.
I work at a large global corporation and we are dropping Java like a hot rock. We've gone years with large teams developing Java Web applications only to find that one person with php can outperform a team of 5 java programmers. Java is extremely unproductive by a factor of 10 (our experience). As far as performance, some php frameworks out there are slow. That's the framework NOT php. We have our own high performance PHP framework and its about twice as fast as our java web applications.
In addition, PHP is improving its technology at a rate that far exceeds Java. Java has a bloat problem which can't be resolved because the language maintainer OWN the class libraries.
精彩评论