views:

447

answers:

9

Money, Staff, Skill and preference to open source or commercial is neutral. Lets take the best of the best programmers (for arguments sake) and think about this:

What will perform better overall:

PHP & MySQL

or

ASP.Net & Microsoft SQL


  • (I don't want biased answers, just looking for Performance, and Speed).


+8  A: 

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

AZ
On your comment "Plus SQL Server(2005+) is way better than MySQL for serious DB stuff"- what kind of serious stuff, like banking, or a huge social site? Is MySql less reliable, or is it going to be more downtime? I know that in MySQL, if you want to add a new index you need to shut the database down... where as in MSSQL it can do it on the fly.
Mike Curry
By "Serious DB stuff" i mean managing databases with large amounts of data, many interconnected tables, big queries with multiple join clauses etc.
AZ
I find SqlServer to be more feature rich thanks to TSQL, also the management tools that come with it are pretty good. Even though similar tools exist for MySQL, SqlServer just feels more user (read programmer) friendly to me.
Kris
+1  A: 

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).

A: 

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.

Tomh
A: 

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.

devdimi
while it may be true that in some scenarios MySQL is faster than SqlServer, I have yet to run into such a scenario, and even then and when, I would probably still go for the richer feature set in SqlServer. (says the Mac guy)
Kris
A: 

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

Carl Bergquist
+1  A: 

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.

Sohnee
+1  A: 

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

KM
I mentioned that Money, Staff, Skill and preference to open source or commercial is neutral. But you do have a point.
Mike Curry
you can spend a lot and still not get a good design, people, and/or tools!
KM
+6  A: 

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.

Kris
A: 

I am a good html coder trying to pick up a good programming lanuage to learn, from what l have observed when it comes to comparing programming lanuages,from the way php is attached by other programmers from other languages, it is likely php is winning the battle and thus they are scare and jealous of it. They world is changing and if you still want to remain valuable in your profession you have embrace the current solution without sentiment

Maxwell