Is it possible to compile ASP.NET to native code?

Can ASP.NET Web Application be Compiled to Machine Language? If so, are there any performance benefits?

+2


source to share


7 replies


Yes, you can: NGen.exe .



Here is a discussion on fooobar.com/questions/296936 / ... on NGen and ASP.NET

+7


source


You can (as Charles showed in his answer), but there is no real advantage in doing this. The IL code is compiled into bytecode the first time a user requests any content from your site. This is called the "Just in Time" compilation. After completing this step, both versions of your site will have the same performance.



+4


source


At the end, an ASP.NET application (be it an "ASP.NET Web Application" or an "ASP.NET Web Site") is compiled to IL, and then when this IL snippet is used, it is further compiled to native code, transparently using .NET Runtime (CLR).

The performance benefits ... are :) This is faster than interpreted websites, etc.

If you want to compile your assemblies (DLLs) to a native format so that it cannot be undone, there are several commercial tools available for both obfuscation and IL / native replacement.

+2


source


While it is actually possible to make an independent .net executable from post-building a .net project using tools like from www.xenocode.com, I don't know if this is true for ASP.NET projects, I also I doubt after the first load of any resource there will be any real performance benefits.

+2


source


If I remember correctly, it can be done. However, apart from academic goals, you shouldn't pursue this idea. There is no significant increase in speed.

When the EXE is compiled, it is compiled to CIL (Common Intermediate Language). It is a platform independent format. When you first run an EXE, the .NET framework will compile the EXE into machine code for the specific machine that the application is running on. The result of this is then cached. Thus, only the first launch will be slightly slower, but subsequent launches will be faster.

If you want to improve speed, especially for a web application, take the time to identify bottlenecks in your application like database queries, etc. Also see where you can apply caching. These are the best approaches to improving performance.

+2


source


Itโ€™s just me and didnโ€™t think about much.

a web application needs a web server to run and this web server does not read the Native code of the operating system and what you might think in a Windows environment ...

but then again ... the EXE is already machine code that the .NET Framework has been compiled and converted ...

so ... oO

0


source


Mono supports AOT compilation (compiled to machine code); but you still need to store the collection information and there are restrictions on its use.

See http://www.mono-project.com/AOT for details .

0


source







All Articles