static void Main(string[] args) { var t = new PerfTests(); Action <Action> test = (action) => { var name = action.Method.Name; action(); // warmup GC.Collect(3, GCCollectionMode.Forced, blocking: true); using (new TimedWriteLine(Console.Out, name)) { action(); } }; test(t.CSharpParseNamed); test(t.FSharpParseNamed); Console.WriteLine(); test(t.CSharpParsePositional); test(t.FSharpParsePositional); Console.WriteLine(); test(t.CSharpParseAndFormatNamed); test(t.FSharpParseAndFormatNamed); Console.WriteLine(); test(t.CSharpParseAndFormatPositional); test(t.FSharpParseAndFormatPositional); Console.WriteLine(); test(t.CSharpFormatPositional); test(t.FSharpFormatPositional); Console.WriteLine(); test(t.CSharpParseAndFormatNamedDestr); test(t.FSharpParseAndFormatNamedDestr); Console.WriteLine(); test(t.CSharpCaptureNamedDestr); test(t.FSharpCaptureNamedDestr); }
static void Main(string[] args) { var t = new PerfTests(); Action<Action> test = (action) => { var name = action.Method.Name; action(); // warmup GC.Collect(3, GCCollectionMode.Forced, blocking: true); using (new TimedWriteLine(Console.Out, name)) { action(); } }; test(t.CSharpParseNamed); test(t.FSharpParseNamed); Console.WriteLine(); test(t.CSharpParsePositional); test(t.FSharpParsePositional); Console.WriteLine(); test(t.CSharpParseAndFormatNamed); test(t.FSharpParseAndFormatNamed); Console.WriteLine(); test(t.CSharpParseAndFormatPositional); test(t.FSharpParseAndFormatPositional); Console.WriteLine(); test(t.CSharpFormatPositional); test(t.FSharpFormatPositional); Console.WriteLine(); test(t.CSharpParseAndFormatNamedDestr); test(t.FSharpParseAndFormatNamedDestr); Console.WriteLine(); test(t.CSharpCaptureNamedDestr); test(t.FSharpCaptureNamedDestr); }