Job Done Logo
Job Done Logo

Blog

ASP NET and PHP - In the Midst of Battle

ASP NET and PHP - In the Midst of Battle


ASP.NET is a set of technologies introduced into the.NET development framework, that are used to produce dynamic web sites, web applications, or web services. The common misunderstanding concerning ASP.NET, as an in-bound web application framework in the CLR of the.NET technology, and PHP, as a scripting language, takes the latter to do the same type of compilation as ASP.NET, a common belief which is highly unfounded.

First of all, when a PHP page is requested, the HTML and in-line PHP scripts are compiled to Zend Opcodes. These Opcodes represent binary instructions from low levels that are used to serve the PHP page. After the compilation process takes place, the Zend engine runs these opcodes, much in the way that the Java runtime engine runs byte code. Following this, HTML is generated and served to the client.

In order to speed up the execution of a PHP page, through the optimization of the opcodes, various third-party commercial products are available, that developers have to install, and another way to increase the performance of PHP scripts is to cache the opcodes and the generated HTML.

With ASP.NET, on the other hand, when a request is queued to the IIS, or other Web server for an.aspx page (or any other extension supported by ASP.NET), that specific request is passed to ASP.NET for processing. When the page is requested for the first time, ASP.NET will compile it to MSIL (Microsoft Intermediate Language), and this intermediate code is then processed by the CLR into machine code. The request is further run using the resulted compiled code. Other subsequent requests form the same page are served using the same machine code, which saves a lot of time.

Moreover, the binary code that CLR generates is already optimized to the fullest, meaning that no add-on is required to achieve maximum performance. Also, an important observation is that everything in ASP.NET is compiled to machine code before being run, which really points out the essential core of the "compiling" meaning - ASP.NET clearly provides the benefit of an efficient, active compiling engine, while PHP simply translates scripts into opcodes and HTML text.

.


 

3sc World |  All Rights Reserved.