Interpreted vs compiled


PHP is an interpreted language and C# is a compliled language. However, we do not see that difference in perfromance in websites. What is the reason of saying compiled languages are faster then? or will the difference appear in large applications?


I think you’re a bit confused here. You shouldn’t be comparing PHP with C#, but rather, PHP with Classic ASP. They are both server-side scripting languages used by web servers, and their code is interpreted.

C# is a language that is used within the ASP.NET framework itself (the successor of Classic ASP). You can write ASP.NET code in many languages, C# being one of them, others being Visual Basic and J#.

PHP and Classic ASP code is interpreted, but the program that interprets the languages is compiled (only its code is really) and executed. ASP.NET code is actually compiled by the server, and then executed. The reason that compiling code is quicker than interpreting it is because you skip the middle-step of having to use an interpreter. Instead of having a separate program on the server interpret the code, it just compiles and executes the code.

but I visited websites built in ASP.NET (C#) and others in PHP and I did not see a difference or I did not notice that (c#) sites were quicker!

You probably won’t notice a difference in most websites. You may, however, notice a difference in websites that are very content heavy in the perspective of the server.

Check this link out:

Interesting comparison. Thanks.:slight_smile:

That test does not show anything sadly, it shows performance of some “search engine” when implemented by some of the languages mentioned in the test.

CSGeek, I think many have told you more than 10 times already that you will not notice a difference in site speed. Majority of the websites load within 1 second. Whether a script did its processing in 15 milliseconds or 20 is of no relevance to you as you cannot make a difference out of these numbers.
Also, is it hard to do some google searching or to perform tests of your own?

The underlying language of hugely visited websites is not the main thing impacting the performance. There are things such as network infrastructure, load balancing, the server accepting requests and passing it to the underlying language, then the actual architecture of the application and so on.
It’s not hard to create a slow website in C and make an incredibly fast one in PHP.