Andrei Sedoi
Andrei Sedoi

Reputation: 1544

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

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 obfuscate (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

Upvotes: 5

Views: 275

Answers (2)

The Evil Greebo
The Evil Greebo

Reputation: 7138

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.

Upvotes: 2

Oded
Oded

Reputation: 499002

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

Upvotes: 4

Related Questions