> http://www.thomasknierim.com/119/java/performance-java-vs-php-vs-scala/

The shootout he's quoting is just a set of microbenchmarks. Totally irrelevant, 
and if Knierim is taking that seriously as grounds for performance comparisons, 
his opinion isn't better. (The shootout does have its merits, but judging the 
performance of programming languages for large projects is not one of them.)

> RE the great comment concerning Facebook being written in PHP

As far as I know, Facebook is partly written in PHP and partly written in C and 
some other language (don't ask, just quoting from memory).

The question, however, is: does it matter?
Both PHP and Java load a huge amount of libraries at startup, so restarting the 
webserver can be an issue. But, on the other hand, you can tune both to load 
just what you need - if performance is starting to hurt you, you have money at 
stake, which means you have money to find the specialists and can solve the 
problems.
PHP is at a serious disadvantage in what an optimizing compiler can do, due to 
run-time type checking. Still, you can always throw another CPU at the problem 
- unless you're doing your deployment at the Facebook&Google scale, the extra 
time and money spent for optimizers and bytecodes is more expensive than simply 
throwing another CPU at the problem. Of course, in the long run, PHP will hit 
the limits harder - but if you're big enough that that starts to matter, you 
have enough money to pay for a rewrite of the system in Java, so who cares. The 
business isn't made or broken by the choice of language.

Of course, if you do it in Java, you won't have self-taught hobbyists coming 
for employment. That makes the selection process easier.
Also, if you do it in Java, you will have less worries about security holes in 
the engine and libraries.
(But I think I wrote that all already.)

In summary: performance isn't irrelevant, but there are lots of far more 
important factors.
And if your shop is full of good(!) PHP programmers, by all means stick with 
PHP.
If your shop is full of bad PHP programmers, switch to Java. The really bad 
PHPists will go without making a fuss about it, and you don't have to explain 
to them how their skills are lacking. ;-P

> IMHO - for right now, I believe Java to be a cogent language

Don't let the Haskell crowd hear this. I think they'd point you to the errors 
in Java's ways, very quickly, and very devastatingly.

> written from the ground up with an OO design pattern.

The one thing that's enlightened in Java's design is basing the namespaces on 
the DNS.
The rest - OO boilerplate, at a fairly fundamental level of understanding. They 
overlooked a LOT of fine points. For example, it took them years to even 
recognize that generics are desirable, and Gosling hasn't understood the true 
value of contracts to this day.
Well, we all can make a better language if we dare I guess :-)
Plus, within the boundaries that being compatible to historical misdecisions in 
Java's type system, the Java generics are a fine piece of design.

>  That the performance is near C++ speeds.

Really?
I would suspect that this either underestimates what a decent C++ compiler can 
optimize, or overestimates the results of Java optimization.
Java has the problem of dynamic class loading, which makes many optimizations 
impossible. (You can optimize assuming no new class will come into the system, 
but then you force the entire system to be re-optimized after loading a new 
class.)

>  That the libraries available are professional and reliable.

Depends on the library.
I have been quite unimpressed by what Hibernate does. Swing's table cell 
renderer/editor concepts are documented poorly and don't very well anyway. Etc.

> That Cayenne Rocks!.

Heh :-)
I guess others can say more about that.


Anyway. Sorry for the length myself, and my stance is: performance isn't very 
important for most projects anymore.

Regards,
Jo

Reply via email to