// 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; namespace E { public class Program { private static int z = 0; private static void crap(int x) { if(x < 0) z++; } private static int func(int param1) { int x = 0; int nTicks = Environment.TickCount; for(int j = 0; j < 10; j++) { for( int i=0;i< 30000000; i++) { x = x + param1; x = x * 2; x = x + 1; crap(x); } for (int i = 0; i < 30000000; i++) { x = x - 1; x = x / 2; x = x - param1; crap(x); } } int nTimePassed = Environment.TickCount - nTicks; Console.WriteLine("Milliseconds: " + nTimePassed); return x; } public static void Main(string[] args) { int x = func(1) + func(2) + func(3) + func(4) + func(5) + func(6) + func(7) + func(8) + func(9); } } }