Platform: .NET Framework 3.5 SP1 on x32
Are there any performance issues regarding leaving an empty statement (‘;’, by itself) in code?
And to be marked as an answer would you also teach a man (me? and other people reading this) to fish? Meaning, how to figure out there is a performance issue with it?
1) Use a tool like ildasm or .NET Reflector to look inside the assembly that is generated and see what IL instructions are associated with the ‘;’ empty statement (if any at all; they might get optimized away into nothing.)
2) Use a profiler to run a huge loop with a bunch of ‘;’s included inside other code, and then try it without the ‘;’s and see if there’s a difference.
(Without doing either of these I’d bet quite a lot that it’s optimized away and produces no IL (or some kind of no-op instruction — pardon my IL ignorance.))