Advertisement
NPSF3000

C# i++ to a billion

May 31st, 2011
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Diagnostics;
  6.  
  7. namespace simple_performance_test
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Stopwatch clock = new Stopwatch();
  14.             while (true)
  15.             {
  16.                 Console.WriteLine("");
  17.                 Console.WriteLine("Starting Test");
  18.  
  19.                 clock.Restart();
  20.                 int i = 0;
  21.                 for (; i < 1000000000; i++) ;
  22.                 clock.Stop();
  23.  
  24.                 Console.WriteLine("Took " + clock.ElapsedMilliseconds + " to iterate to " + i);
  25.                 Console.ReadKey();
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement