Пример #1
0
 static void Main(string[] args)
 {
     // Use reflection for a more maintainable way of creating the benchmark switcher,
     // Benchmarks are listed in namespace order first (e.g. BenchmarkDotNet.Samples.CPU,
     // BenchmarkDotNet.Samples.IL, etc) then by name, so the output is easy to understand
     var benchmarks = Assembly.GetExecutingAssembly().GetTypes()
         .Where(t => t.GetMethods(BindingFlags.Instance | BindingFlags.Public)
                      .Any(m => m.GetCustomAttributes(typeof(BenchmarkAttribute), false).Any()))
         .OrderBy(t => t.Namespace)
         .ThenBy(t => t.Name)
         .ToArray();
     var competitionSwitch = new BenchmarkSwitcher(benchmarks);
     competitionSwitch.Run(args);
 }
Пример #2
0
 public static void Main(string[] args)
 {
     BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
 }
Пример #3
0
 static void Main(string[] args)
 {
     BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, DefaultConfig.Instance);
 }
Пример #4
0
 static void Main(string[] args)
 {
     // Without the line below, parameters with decimals will be outputted with commas in certain cultures
     Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
     BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
 }
Пример #5
0
 private static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).GetTypeInfo().Assembly).Run(args);
Пример #6
0
 static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, new StandardConfig());
Пример #7
0
 static void Main()
 {
     BenchmarkSwitcher.FromTypes(Assembly.GetExecutingAssembly().GetTypes()
                                 .Where(t => t.IsSubclassOfRawGeneric(typeof(BenchmarkBase <>))).ToArray()).RunAllJoined();
     Console.ReadKey();
 }
Пример #8
0
 static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, new CustomConfig().Config);
Пример #9
0
 // the args must contain:
 // an information that we want to run benchmark as Wasm:
 // --runtimes Wasm
 // path to dotnet cli
 // --cli /home/adam/projects/runtime/dotnet.sh
 // path to main js:
 // --wasmMainJs /home/adam/projects/runtime/src/mono/wasm/runtime-test.js
 public static void Run(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(IntroWasmCmdConfig).Assembly).Run(args);
Пример #10
0
 static void Main(string[] args)
 {
     BenchmarkSwitcher.FromAssembly(typeof(Program).GetTypeInfo().Assembly).Run(args);
     Console.Read();
 }
Пример #11
0
    public static void Main(string[] args)
    {
        BenchmarkSwitcher switcher = new BenchmarkSwitcher(typeof(Program).Assembly);

        switcher.Run(args);
    }
Пример #12
0
 static void Main(string[] args) =>
 BenchmarkSwitcher.FromAssembly(typeof(Run).Assembly).Run(args);
Пример #13
0
        static void Main(string[] args)
        {
            SimdInfo.PrintSimdInfo(Console.Out);

            BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
        }
Пример #14
0
 public static void Main(string[] arguments) =>
 BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(arguments, DefaultConfiguration);
Пример #15
0
 public static void Main(string[] args)
 {
     BenchmarkSwitcher.FromAssembly(typeof(StringIsNullOrEmptyBenchmark).Assembly).Run(args);
 }
Пример #16
0
 static int Main(string[] args)
 => BenchmarkSwitcher
 .FromAssembly(typeof(Program).Assembly)
 .Run(args, GetConfig())
 .ToExitCode();
Пример #17
0
        public static void Main(string[] args)
        {
            const string dataDirVar       = "BENCODEX_BENCHMARKS_DATA_DIR";
            const string simpleModeVar    = "BENCODEX_BENCHMARKS_SIMPLE";
            const string decodeOnlyVar    = "BENCODEX_BENCHMARKS_DECODE_ONLY";
            const int    simpleModeSample = 50;

            bool ToBool(string?v) =>
            new[] { "1", "t", "true", "y", "yes", "on" }.Contains(v?.ToLowerInvariant());

            string dirPath =
                Environment.GetEnvironmentVariable(dataDirVar) ?? ".";

            Console.Error.WriteLine("Look up Bencodex benchmark data files in {0}...", dirPath);
            Console.Error.WriteLine("(You can configure the directory to look up by setting {0}.)",
                                    dataDirVar);

            bool simpleMode = ToBool(Environment.GetEnvironmentVariable(simpleModeVar));
            bool decodeOnly = false;

            if (simpleMode)
            {
                Console.Error.WriteLine(
                    "Run benchmarks on the simple mode, which samples only the heaviest {0} files" +
                    "and also does not use BenchmarkDotNet...",
                    simpleModeSample
                    );
                Console.Error.WriteLine("You can profile the benchmarks on the simple mode.");

                decodeOnly = ToBool(Environment.GetEnvironmentVariable(decodeOnlyVar));
                if (decodeOnly)
                {
                    Console.Error.WriteLine("Benchmark only decoding...");
                }
                else
                {
                    Console.Error.WriteLine(
                        "If you want to benchmark only decoding, configure {0}=true.",
                        decodeOnlyVar
                        );
                }
            }
            else
            {
                Console.Error.WriteLine("Run benchmarks using BenchmarkDotNet...");
                Console.Error.WriteLine(
                    "There is the simple mode too, which can be turned on by setting {0}=true.",
                    simpleModeVar
                    );
            }


            FileInfo[] files;
            if (Directory.Exists(dirPath))
            {
                files = Directory.EnumerateFiles(dirPath, "*.dat", SearchOption.AllDirectories)
                        .Select(p => new FileInfo(p))
                        .ToArray();
            }
            else
            {
                files = new[] { new FileInfo(dirPath) };
            }

            if (simpleMode)
            {
                files = files.OrderByDescending(f => f.Length).Take(simpleModeSample).ToArray();
            }

            int  count = 0;
            long size  = 0;

            foreach (FileInfo file in files)
            {
                size += file.Length;
                Console.Error.WriteLine("{0}", file);
                count++;
            }

            ByteSize byteSize = ByteSize.FromBytes(size);

            Console.Error.WriteLine(
                "Loading {0} files ({1} = {2} bytes)...", count, byteSize, size);

            if (simpleMode)
            {
                SimpleMode(files, decodeOnly);
            }
            else
            {
                DataFiles = files.Select(f => f.FullName).ToArray();
                BenchmarkSwitcher.FromAssembly(typeof(CodecBenchmark).Assembly).Run(args);
            }
        }
Пример #18
0
 public static void Main(string[] args)
 {
     BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); //, new DebugInProcessConfig());
 }
Пример #19
0
 public static void Main(string[] args)
 => BenchmarkSwitcher
 .FromAssembly(typeof(Program).Assembly)
 .Run(args, CreateCustomConfig());
Пример #20
0
 static void Main(string[] args)
 {
     BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
     // ProgrammRunner.Run(new ComplexOperationTestProgram());
     // ProgrammRunner.Run(new EdgePreservingSmoothingProgram());
 }
Пример #21
0
        static void Main(string[] args)
        {
            InitArrays();

            BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
        }
Пример #22
0
        static void Main(string[] args)
        {
            //if (args.Length == 0)
            //{
            //	//	var b1 = new FetchGraphBenchmark();
            //	//	var b2 = new FetchIndividualBenchmark();
            //	//	var b3 = new FetchSetBenchmark();
            //	//	var b4 = new InsertSetBenchmark();
            //	//	var b5 = new SelectBenchmark();
            //	//	var b6 = new UpdateBenchmark();
            //	//	var b7 = new QueryGenerationBenchmark();
            //	var b8 = new Issue3253Benchmark();

            //	//	b1.Setup();
            //	//	b2.Setup();
            //	//	b3.Setup();
            //	//	b4.Setup();
            //	//	b5.Setup();
            //	//	b6.Setup();
            //	//	b7.Setup();
            //	b8.Setup();

            //	for (var i = 0; i < 10; i++)
            //	{
            //		//		b1.Compiled();
            //		//		b1.Linq();

            //		//		b2.Compiled();
            //		//		b2.Linq();

            //		//		b3.Compiled();
            //		//		b3.Linq();

            //		//		b4.Test();

            //		//		b5.Compiled();
            //		//		b5.Execute();
            //		//		b5.FromSql_Formattable();
            //		//		b5.FromSql_Interpolation();
            //		//		b5.Linq();
            //		//		b5.Query();

            //		//		b6.CompiledLinqObject();
            //		//		b6.CompiledLinqSet();
            //		//		b6.LinqObject();
            //		//		b6.LinqSet();
            //		//		b6.Object();

            //		//		b7.VwSalesByCategoryContains();
            //		//		b7.VwSalesByYear();
            //		//		b7.VwSalesByYearMutation();

            //		b8.Small_UpdateStatement_With_Variable_Parameters();
            //		//b8.Small_UpdateStatement_With_Variable_Parameters_Async();
            //		b8.Small_UpdateStatement_With_Static_Parameters();
            //		//b8.Small_UpdateStatement_With_Static_Parameters_Async();
            //		b8.Large_UpdateStatement_With_Variable_Parameters();
            //		//b8.Large_UpdateStatement_With_Variable_Parameters_Async();
            //		b8.Large_UpdateStatement_With_Static_Parameters();
            //		//b8.Large_UpdateStatement_With_Static_Parameters_Async();
            //		b8.Large_UpdateStatement_With_Variable_Parameters_With_ClearCaches();
            //		//b8.Large_UpdateStatement_With_Variable_Parameters_With_ClearCaches_Async();

            //		b8.Small_InsertStatement_With_Variable_Parameters();
            //		//b8.Small_InsertStatement_With_Variable_Parameters_Async();
            //		b8.Small_InsertStatement_With_Static_Parameters();
            //		//b8.Small_InsertStatement_With_Static_Parameters_Async();
            //		b8.Large_InsertStatement_With_Variable_Parameters();
            //		//b8.Large_InsertStatement_With_Variable_Parameters_Async();
            //		b8.Large_InsertStatement_With_Static_Parameters();
            //		//b8.Large_InsertStatement_With_Static_Parameters_Async();
            //		b8.Large_InsertStatement_With_Variable_Parameters_With_ClearCaches();
            //		//b8.Large_InsertStatement_With_Variable_Parameters_With_ClearCaches_Async();
            //		b8.Large_Compiled_InsertStatement_With_Variable_Parameters();
            //		b8.Large_InsertStatement_With_Variable_Parameters_Using_Expression_Overload();
            //		//b8.Large_InsertStatement_With_Variable_Parameters_Using_Expression_Overload_Async();
            //	}

            //	return;
            //}
            //TestConcurrent();

            /*
             * VwSalesByCategoryContainsPerf();
             * return;
             */

            BenchmarkSwitcher
            .FromAssembly(typeof(Program).Assembly)
            .Run(
                args.Length > 0 ? args : new[] { "--filter=*" },
                Config.Instance);
        }
Пример #23
0
 static void Main(string[] args)
 {
     BenchmarkSwitcher
     .FromAssembly(typeof(Common.CommonTest).Assembly)
     .Run(new string[] { "--job", "short", "--runtimes", "netcoreapp31", "--filter", "*" }, new AllowNonOptimized());
 }
Пример #24
0
 /// <summary>
 /// execute dotnet run -c Release and choose the benchmarks you want to run
 /// </summary>
 /// <param name="args"></param>
 public static void Main(string[] args)
 => BenchmarkSwitcher
 .FromAssemblyAndTypes(typeof(Program).Assembly, GetGenericBenchmarks())
 .Run(args /*, CreateClrVsCoreConfig() uncomment it to run Clr vs .NET Core comparison*/);
Пример #25
0
 static void Main(string[] args)
 {
     BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, new DebugInProcessConfig());
     Console.ReadKey();
 }
Пример #26
0
 static void Main(string[] args)
 {
     BenchmarkSwitcher.FromAssembly(Assembly.GetExecutingAssembly()).Run(args);
 }
Пример #27
0
 public static void Main(string[] args)
 {
     BenchmarkSwitcher
     .FromAssembly(typeof(Program).Assembly)
     .Run(args, DefaultConfig.Instance.WithOption(ConfigOptions.DisableOptimizationsValidator, true));
 }
Пример #28
0
 public static void Main(string[] args)
 {
     BenchmarkSwitcher.FromAssembly(typeof(ShapeFactoryBenchmark).Assembly).Run(args);
 }
Пример #29
0
        private static void Main(string[] args) =>

        _ = BenchmarkSwitcher
            .FromAssembly(typeof(InsightBenchmark).Assembly)
            .Run(args, new Config());
Пример #30
0
 static void Main(String[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
Пример #31
0
 static void Main(string[] args)
 {
     BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
     //BenchmarkRunner.Run<HashAlgorithmBenchmark>();
 }