[progress Communities] [progress Openedge Abl] Forum Post: Re: Simple Loop Is Slow Compared...

  • Thread starter Thread starter Matt Baker
  • Start date Start date
Status
Not open for further replies.
M

Matt Baker

Guest
Using C# instead of visual studio and using ilspy to see what this does: This is what the byte code looks like. The compiler converted my while loop to a for loop and removed the increment on the integer. So it becomes a do nothing loop. I suspect if I ran this a few hundred times the JIT would throw out the loop completely. Original version: Using C# instead of visual studio and using ilspy to see what this does: // ConsoleApplication2.Program private static void Main(string[] args) { int i = 0; while (i < 999999999) { i = i + 1; } Console.WriteLine("done"); bytecode version // ConsoleApplication2.Program private static void Main(string[] args) { for (int i = 0; i < 999999999; i++) { } Console.WriteLine("done"); }

Continue reading...
 
Status
Not open for further replies.
Back
Top