bas - "if PHP is so slow/bad/whatever, then why will Yahoo.com "switch from a proprietary system written in C/C++ to PHP for their backend scripting"?"
Performance is just one factor when choosing a platform for web deliverables. Another big factor is ease of migration, and if your systems run Unix (like Yahoo's do); it makes sense to stay on your existing platform.
As far as PHP vs ASP.NET comparisons, here ya go:
http://www.webmasterbase.com/article/871
That was written by a PHP guy. While he doesn't give any benchmarks, he does say:
"Just like all .NET applications, ASP.NET applications are compiled. This makes them much faster than PHP, whose applications are interpreted. To achieve the same effect with PHP, Zend and PHP accelerator must be installed on the server, and this is rarely the case at most Web hosting companies. Also, OO is much faster in ASP.NET than it is in PHP."
I haven't been able to find any direct performance comparisons (mostly because they wouldn't be fair, since ASP.NET is compiled, where as PHP is interpreted), but here are some comparisons of PHP vs JSP vs ASP and JSP vs ASP.NET, and of course ASP.NET vs ASP.
ASP.NET beats the pants off both JSP and ASP, so it is logical to make the conclusion that ASP.NET beats PHP in terms of raw speed:
http://www.sloppycode.net/benchmark/
http://www.gotdotnet.com/team/compare/nileperf.aspx
http://www.gotdotnet.com/team/compare/petshopperf.aspx
That's just talking about speed. As far as which is "better", as I said before, many factors are involved.
There are several huge benefits that ASP.NET has over PHP, most of which are gone over in the first link's article. My favorites include the separation of code from content.
In PHP, you're forced to intermix your PHP with the HTML you're formatting your data with, making things hard to maintain. In ASP.NET, you have a code behind file that contains all your code, and then you have a aspx file that contains all your HTML. This makes things MUCH easier to maintain. Not to mention things like Server Controls and User Controls, which provide a way of creating blackbox pieces of code/content that can be reused, or even inherited from.
PHP just can't compete as far as speed, maintainability, productivity, etc. The only reason to stick with or choose PHP is if you have a significant investment in a platform that can't do ASP.NET, or if your workforce is already trained in PHP. Considering Yahoo had quite possibly the most un-maintainable system possible (C/C++ CGIs), PHP is a huge improvement for them... although I would have gone with JSP/J2EE in their case. (Perhaps app server costs made the JSP/J2EE approach prohibitive.)
|