Question

Money, Staff, Skill and preference to open source or commercial is neutral.

Let's take the best of the best programmers (for arguments sake) and think about this:

What will perform better overall:

  • PHP & MySQL

or

  • ASP.Net & SQL Server

(I don't want biased answers, just looking for performance and speed).

Was it helpful?

Solution

I'm the PHP guy (that also does .NET) that is going to say: All things being equal (programmer skill with the chosen platform, hardware, bandwith, etc.) ASP.NET with SqlServer is going to be faster than PHP with MySQL (at runtime). There is no way in hell an interpreted language can beat a compiled language at runtime speed.

I'd like to coin the question: "does it matter" and I cannot answer that one for you. but in my case, and most i've run into the answer was a definate no. I find that usually the difference in raw speed in (well designed) code is negligable, though ofcourse YMMV.

The choice mostly depends on the answer to the question: "when do you want to be fast?"

  1. while writing code
  2. while running code
  3. while debugging code
  4. all of the above

The only case where PHP would beat ASP.NET most of the time is 1; while writing code There are two cases where ASP.NET wins hands down; 2 and 3, running and debugging code.

If you want the fastest overall, The answer will be undefined until we know the time spent in each of 1, 2 and 3 using both platforms.

OTHER TIPS

ASP.NET is compiled (and uses a pretty effective runtime with a state of the art JIT and Garbage Collector) while PHP is an interpreted scripting language. I'll go with .NET on this one. Plus SQL Server(2005+) is way better than MySQL for serious DB stuff

I have seen reports that show mysql to be faster for some simple scenarios (i.e. put to single table, get from single table). But the speed difference is not going to be enormous. My experience is that any perceptible slowness in a website is due to one of (1) insufficient hardware for the db (e.g. simply not enough disk i/o or enough ram) or (2) complexity of database needs (related to necessary contention for what you want to get done). So the simple scenarios where mysql excels are not likely to be of the highest concern for avoiding a slow site. My point of view is that it is pretty trivial to add additional front end servers, so asp.net or php doesn't really matter much. It is generally quite hard to scale out on the database side (it can be done, but at much greater complexity).

I've worked on both and so I've actually looked into this and the answer really is "it doesn't matter".

From a user perspective, more time is spent queuing the HTTP requests than is spent executing the code, be it PHP/MySql or ASP.NET/MSSQL. If you had a website that was written in one of those languages, it would almost always be cheaper to increase the specs of the server to get performance than re-write in another langugage.

In my experience, although .NET SHOULD be faster, similar PHP pages are more responsive and they're pretty much functionally identical (very simple CMS sites with pages and products in a database). I develop both, so I've seen plenty of sites in both.

your application design and the skill level of the people will make the largest impact on performance

For web applications it probably doesn't matter when it comes picking PHP or ASP.NET since they both will spend most time waiting. ASP.NET is compiled and runs on the CLR while PHP is interpreted and has bytecode caching which greatly speeds up execution.

MySQL and MSSQL is hard to tell. Most very large websites run on MySQL. Facebook, Yahoo, Google, Digg, Twitter all have stuff running in MySQL. Unless you do some business intelligence stuff where you need MSSQL specific features for I wouldn't use it. It is very expensive and there is no proven benefit in performance.

You can get very good performance from both combinations. ASP.NET - compiled, can run faster as it is compiled.

However there are some good php has some good caching addons, that actually save the generated php bytecode. Other thing to consider for php ist that most of its library is actually written in C and is compiled. With php you have a lot less code, that is running - no framework, request/context/response objects and instantiation of control trees. Overall php can run very fast.

I would go for ASP.NET for a corporate web application and php for a public web site.

For the databases - mysql can be a little faster than MSSQL for some scenarios but both of them are very good.

You wont get any numbers. But if you really want numbers I suggest you try the both and measure.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow