// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; class SpeedTest { private const int N = 1000000000; public static int Main() { long t1 = DateTime.Now.Ticks; double sum = 0; for(int i = 0; i < N; i++) { sum = ((sum + 1) * 2 + 1) / 2; } long t2 = DateTime.Now.Ticks; if(Math.Abs(sum - 1.5*N) > 1) { Console.WriteLine("Error"); } else { Console.WriteLine(N + " operations in " + ((t2 - t1) / 10000000) + " seconds"); } return 0; } }