// 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 MainClass { public static string Fixed(int a0, int a1, int a2) { return "1 2 3"; } public static string Plus(int a0, int a1, int a2) { return (a0 + " " + a1 + " " + a2); } public static string Format(int a0, int a1, int a2) { return String.Format("{0} {1} {2}", a0, a1, a2); } private const int N = 10000000; public static void Main(string[] args) { long t1 = DateTime.Now.Ticks; for(int i = 0; i < N; i++) { if(Fixed(1, 2, 3) != "1 2 3") { Console.WriteLine("Oops"); Environment.Exit(0); } } long t2 = DateTime.Now.Ticks; long t3 = DateTime.Now.Ticks; for(int i = 0; i < N; i++) { if(Plus(1, 2, 3) != "1 2 3") { Console.WriteLine("Oops"); Environment.Exit(0); } } long t4 = DateTime.Now.Ticks; Console.WriteLine("Plus " + (t4 - t3 - t2 + t1)); long t5 = DateTime.Now.Ticks; for(int i = 0; i < N; i++) { if(Format(1, 2, 3) != "1 2 3") { Console.WriteLine("Oops"); Environment.Exit(0); } } long t6 = DateTime.Now.Ticks; Console.WriteLine("Format " + (t6 - t5 - t2 + t1)); } } }