开发者

C#. Does shortening identifier names increase overall run-time performance of an application?

开发者 https://www.devze.com 2023-03-20 12:24 出处:网络
Shortening identifier names makes the resulting executable smaller in size since MSIL code includes all these names except local variable ones. Does it affect executing the code in .NET runtime in a g

Shortening identifier names makes the resulting executable smaller in size since MSIL code includes all these names except local variable ones. Does it affect executing the code in .NET runtime in a good way in terms of performance, at least in theory? Native machine code doesn't include all those names but it interoperates with .NET runtime. So I wonder if it makes sense to ob开发者_开发技巧fuscate (namely shorten identifier names) the MSIL code in order to increase the run-time performance of the application at least a little.

I was surprised by this statement: "Dotfuscator improves run-time performance. By removing unneeded program elements and renaming identifiers to small names, Dotfuscator can actually speed up programs." http://msdn.microsoft.com/en-us/library/ms227226.aspx


The identifier names get discarded by the compiler/jitter, so this will not make any difference.


The first time you run an application, the MSIL is compiled to machine code for that platform - after that the machine code is executed. So theoretically, I would think the 1st time compile MIGHT be affected, but the final machine code execution time which doesn't use those names won't change a whit after the machine compilation is done.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号