Is there a way to get the .Net JIT or C# compiler to optimize away empty for-loops? -
A followup for this:
The following program only runs an empty loop one billion times and prints It's time to run away. It takes 700 ms on my machine, and I'm curious if jitter has a way to remove the empty loop.
using the system; Namespace Console Application 1 {class program {static zero main () {var start = DateTime.Now; (Var i = 0; i & lt; 1000000000; i ++) {} console for WrightLine ((DateTime.Now - Start). Total Emilicounds); }}} As far as I can not answer, but I do not know whether there are hidden compiler options that I have not tried, I have certainly compiled it in release mode and No debugger is attached, but still 700 ms are being taken to run this empty loop. I also tried NGN with the same result (though my understanding is that he should make the same compiled code as JIT, right?). However, I have never used NGN and it is misusing it.
It looks like like finding and optimizing JIT would be easy, but to know very little about doing abusive behavior in general, I'm curious if someone The specific reason being that this optimization would have been left apart, the VC + compiler certainly appears to make this optimization, so I wonder why there is anomaly. Any ideas?
No, I know that. The exact reason is that why I am not clear, the fear optimizer definitely knows how to adapt and it is easily eliminated from dead code. Check for details I believe it was deliberately, its Probably for the side-effects of leaving the loop in place, consumer time which course only applies to a spinewight is understood for very small ends.
Comments
Post a Comment