Thursday July 30th

Wednesday July 29th

Learning ILAsm, the backbone of .NET

An tutorial on http://www.refactorthis.net on ILasm.

2 comments

Sometimes, in very specific cases, you can squeak more performance out of a C program by using inline assembly. I wonder if there are similar cases when it comes to .Net? I have on occasion made use of the unsafe keywords to handle pointers and memory management myself for better performance, but I've never bypassed the compiler and used ilasm.

That's a very interesting question. I would take an instance in which you have used unsafe code and bypassed memory management and then use ILDasm.exe to disassemble the code to see what the IL looks like. That will give you a chance to see how IL handles such instances. IL has support for objects and I would imagine that objects are larger memory wise than their simple data type counter parts. You could disassemble an application and find instances in which the compiler uses a class in IL but you can accomplish the same thing utilizing a smaller data type. It seems to me that this would in theory run faster. Also, you could always look at how certain methods in the FCL are represented in IL and then see if you can accomplish the same task more efficiently. I any event you've inspired me to create a new post on http://www.refactorthis.net on executing inline IL to boost performance. Excellent question!! Thanks for reading!!

http://www.twitter.com/budbjames
http://www.refactorthis.net

Commenting on Stories is limited for now and will open up to those recommended by the community. Learn how
Loading DotNetKicks...
brought to you by the Kicks Network