Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            var summaries = BenchmarkSwitcher.FromTypes(
                Assembly.GetExecutingAssembly().GetTypes().Where(t => typeof(AbstractBenchmark).IsAssignableFrom(t) && !t.IsAbstract).ToArray()
                // new [] { typeof(WDBC.AchievementAllocationBenchmark) }
#if DEBUG
                ).Run(args, new DebugInProcessConfig());
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            Logger.Log("Started running performance tests.");

            try
            {
                BenchmarkSwitcher.FromTypes(new[] {
                    typeof(AcquireTokenForClientCacheTests),
                    typeof(AcquireTokenForOboCacheTests),
                    typeof(TokenCacheTests),
                    typeof(AcquireTokenNoCacheTests),
                }).RunAll(
#if DEBUG
                    new DebugInProcessConfig()
#else
                    DefaultConfig.Instance
#endif
                    .WithOptions(ConfigOptions.DisableLogFile)
                    .WithOptions(ConfigOptions.JoinSummary)
                    //.WithOptions(ConfigOptions.DontOverwriteResults) // Uncomment when running manually
                    .AddDiagnoser(MemoryDiagnoser.Default) // https://benchmarkdotnet.org/articles/configs/diagnosers.html
                                                           //.AddDiagnoser(new EtwProfiler()) // https://adamsitnik.com/ETW-Profiler/
                    .AddJob(
                        Job.Default
                        .WithId("Job-PerfTests")));
            }
            catch (Exception ex)
            {
                Logger.Log("Error running performance tests.");
                Logger.Log(ex.ToString());
                throw;
            }

            Logger.Log("Completed running performance tests.");
        }
Exemplo n.º 3
0
 public static void Main(string[] args)
 {
     BenchmarkSwitcher.FromTypes(new[]
     {
         typeof(WriteFormatsBenchmark),
         typeof(ReadFormatsBenchmark),
     }).Run(args);
 }
Exemplo n.º 4
0
 private static void Main(string[] args)
 {
     BenchmarkSwitcher.FromTypes(new[] {
         typeof(PuzzleBenchmarker),
         typeof(CsvBenchmarker),
         typeof(GeneratorBenchmarker)
     }).Run(args);
 }
Exemplo n.º 5
0
        public void Run()
        {
#if BENCHMARK
            BenchmarkSwitcher.FromTypes(new[] { this.GetType() }).RunAllJoined(_config);
#else
            Console.WriteLine(nameof(Benchmarks) + " are only supported in the benchmark build.");
#endif
        }
Exemplo n.º 6
0
 static void Main(string[] args)
 => BenchmarkSwitcher.FromTypes
 (
     GetOpenGenericBenchmarks()
     .SelectMany(openGeneric => GetViewModels().Select(viewModel => openGeneric.MakeGenericType(viewModel)))
     .ToArray()
 )
 .Run(args, new BenchmarkConfig());
Exemplo n.º 7
0
 static void Main(string[] args) =>
 BenchmarkSwitcher.FromTypes(new[]
 {
     typeof(TaskFromResultOrCompletedTask),
     typeof(ReturnTaskOfT),
     typeof(ValueTaskVsTaskRecommendedScenario),
     typeof(ReturnAwaitOrReturnTask),
 }
                             ).Run(args, new BenchmarkConfig());
Exemplo n.º 8
0
        static void Main(string[] args)
        {
#if DEBUG
            new XlsxBenchmark().Epplus_QueryFirst_Test();
#else
            BenchmarkSwitcher.FromTypes(new[] { typeof(XlsxBenchmark) }).Run(args, new Config());
#endif
            Console.Read();
        }
Exemplo n.º 9
0
        public static void Main(string[] args)
        {
            var switcher = BenchmarkSwitcher.FromTypes(new[]
            {
                typeof(SerializerBenchmark),
                typeof(BoolBenchmark)
            });

            switcher.Run(args);
        }
 static void Main(string[] args)
 {
     BenchmarkSwitcher.FromTypes(new[]
     {
         typeof(Swapping),
         typeof(Inlining),
         typeof(FibonacciCalc),
         typeof(StringFormatting),
     }).Run(args);
 }
Exemplo n.º 11
0
        static void Main()
        {
            //JitDump code:
            //var type = new Assembler().CompileDelegateType<IAsmDelegateVoid>(Enumerable.Empty<Instruction>(), "Testy");
            //var benchmarkType = typeof(Asm<>).MakeGenericType(type);
            //IBenchmark bench = (IBenchmark)Activator.CreateInstance(benchmarkType);
            //bench.Test();

            BenchmarkSwitcher.FromTypes(TestSource.GetBenchmarkTypes(typeof(Asm <>)).ToArray()).RunAllJoined();
        }
Exemplo n.º 12
0
        static void Main(string[] args)
        {
#if !DEBUG
            BenchmarkSwitcher.FromTypes(new[] { typeof(XlsxBenchmark) }).Run(args, new Config());
#else
            BenchmarkSwitcher.FromTypes(new[] { typeof(XlsxBenchmark) }).Run(args, new DebugInProcessConfig());
            //new TemplateXlsxBenchmark().MiniExcel_Template_Generate_Test();
            //new XlsxBenchmark().MiniExcelCreateTest();
#endif
            Console.Read();
        }
 static void Main(string[] args)
 {
     BenchmarkSwitcher.FromTypes(new[] {
         typeof(PingMessageBenchmarks),
         typeof(InvocationMessageBenchmarks),
         typeof(StreamInvocationMessageBenchmarks),
         typeof(StreamItemMessageBenchmarks),
         typeof(CompletionMessageBenchmarks),
         typeof(CancelInvocationMessageBenchmarks),
         typeof(CloseMessageBenchmarks)
     }).Run(args);
     //var summary = BenchmarkRunner.Run<MessageDescriptorBenchmarks>();
 }
Exemplo n.º 14
0
        public static void Main(string[] args)
        {
            var switcher = BenchmarkSwitcher.FromTypes(new[]
            {
                typeof(AddGetRemove),
                typeof(Contains),
                typeof(AddGetRemove_Cluster),
                typeof(Contains_Cluster),
                typeof(HashesBenchmark)
            });

            switcher.Run(args);
        }
Exemplo n.º 15
0
        static void Main(string[] args)
        {
            ParserBenchmark pb = new ParserBenchmark();

            pb.GlobalSetup();

            BenchmarkSwitcher.FromTypes(new Type[]
            {
                typeof(ParserBenchmark)
            })
            .RunAllJoined();
            Console.ReadKey();
        }
Exemplo n.º 16
0
        public static void Main(string[] args)
        {
            var types = new Type[]
            {
                typeof(SolvingOisBenchmark),
                typeof(LinearRegression),
                typeof(InterpolationBenchmark),
                typeof(MultiLinearRegression),
                typeof(WritingDoubleVectorVsDouble),
                typeof(SobolBlockGeneration),
            };
            var switcher = BenchmarkSwitcher.FromTypes(types);

            switcher.Run(args);
        }
Exemplo n.º 17
0
        static void Main(string[] args)
        {
            var switcher = BenchmarkSwitcher.FromTypes(new []
            {
                typeof(SerializationBenchmarks),
                typeof(DeserializationBenchmarks),
            });

            switcher.RunAll();

            var benchmarks = new SerializationBenchmarks();

            Console.WriteLine("Google Protobuf size: {0} bytes", benchmarks.GoogleProtobuf());
            Console.WriteLine("Protobuf.NET size:    {0} bytes", benchmarks.ProtobufNet());
            Console.WriteLine("Compact Bond:         {0} bytes", benchmarks.CompactBond());
            Console.WriteLine("Fast Bond:            {0} bytes", benchmarks.FastBond());
        }
Exemplo n.º 18
0
 public static void Main(string[] args)
 {
     BenchmarkSwitcher.FromTypes(new [] { typeof(BaselineBenchmark), typeof(NoSamplingBenchmark), typeof(DefaultBenchmark) }).RunAllJoined(
         DefaultConfig.Instance
         .With(
             new Job()
             .With(RunStrategy.Monitoring)
             .WithLaunchCount(3)
             .WithWarmupCount(1)
             .WithIterationTime(TimeInterval.FromSeconds(10))
             .WithCustomBuildConfiguration("ReleaseV3")
             .WithOutlierMode(OutlierMode.DontRemove)
             )
         .With(MemoryDiagnoser.Default)
         .With(HardwareCounter.TotalCycles)
         );
 }
Exemplo n.º 19
0
        private static void Main()
        {
            BenchmarkSwitcher.FromTypes(new[]
            {
                //typeof(DefaultEcs.CreateEntity),
                typeof(DefaultEcs.EntitySetFilter),
                //typeof(DefaultEcs.EntitySetEnumeration),
                //typeof(DefaultEcs.EntitySetWithComponentEnumeration),
                //typeof(DefaultEcs.System),
                //typeof(DefaultEcs.Recorder),
                //typeof(DefaultEcs.Serialization),
                //typeof(Performance.SingleComponentEntityEnumeration),
                //typeof(Performance.DoubleComponentEntityEnumeration),
                //typeof(Message.Publish),
            }).RunAll();

            //BenchmarkSwitcher.FromAssembly(typeof(Program).GetTypeInfo().Assembly).RunAll();
        }
Exemplo n.º 20
0
    public static void Main(string[] args)
    {
        var binaryEncoder = new BinaryEncodeBench();
        var binaryDecoder = new BinaryDecodeBench();
        var arrayEncoder  = new ArrayEncodeBench();

        var encodedIntArrayMAA = arrayEncoder.ArrayInt32Encode_MAA_1M();
        var encodedIntArraySBA = arrayEncoder.ArrayInt32Encode_SBA_1M();
        var areEqual           = encodedIntArrayMAA.Span.SequenceEqual(encodedIntArraySBA.Span);

        if (!areEqual)
        {
            Console.WriteLine("Int32 array encoding test did not pass!");
            return;
        }

        var encodedBinaryMAA = binaryEncoder.Bytes_Encode_MAA();
        var encodedBinarySBA = binaryEncoder.Bytes_Encode_SBA();

        if (!encodedBinaryMAA.Span.SequenceEqual(encodedBinarySBA.Span))
        {
            Console.WriteLine("Binary encoding test did not pass!");
            return;
        }

        var decodedBinaryMAA = binaryDecoder.Bytes_Decode_SBA();

        if (!decodedBinaryMAA.SequenceEqual(AmqpBench.RandomBytes1MB))
        {
            Console.WriteLine("Binary encoding test did not pass!");
            return;
        }

        BenchmarkSwitcher
        .FromTypes(new Type[] {
            typeof(BinaryEncodeBench),
            typeof(BinaryDecodeBench),
            typeof(ArrayDecodeBench),
            typeof(ArrayEncodeBench)
        })
        .Run(args);
    }
Exemplo n.º 21
0
 private static void Main(string[] args)
 {
     try
     {
         BenchmarkSwitcher.FromTypes(new[] {
             typeof(AABBTreeTest),
             //typeof(IndexedLinqTest), //todo: because it very slow
             //typeof(ListTest), //todo: because it very slow
             //typeof(MultiIndexCollectionTest), //todo: because it very slow
             typeof(NTSQuadTreeTest),
             typeof(NTSSTRTreeTest),
             typeof(RBushNetTest),
             typeof(RBushTest),
             typeof(SortedSplitListTest),
             typeof(UnityOctreeTest)
         }).RunAllJoined();
     }
     finally
     {
         Console.WriteLine("TestEnded. Press any key to continue");
         Console.ReadKey();
     }
 }
Exemplo n.º 22
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                var b    = new DeflateCorpus();
                var info = b.GetData().First(d => d.ToString() == "alice29.txt");

                Thread.Sleep(2000);

                for (var i = 0; i < 10000; i++)
                {
                    b.Burnside_ByteArray(info);
                }

                Thread.Sleep(2000);

                for (var i = 0; i < 10000; i++)
                {
                    b.Burnside_Stream(info);
                }
            }
            else
            {
                var benchmarkType = args[0] switch
                {
                    "deflate-synthetic" => typeof(DeflateSynthetic),
                    "deflate-corpus" => typeof(DeflateCorpus),
                    "allocation" => typeof(AllocationBenchmarks)
                };

                BenchmarkSwitcher.FromTypes(new[] { benchmarkType }).Run(((Span <string>)args).Slice(1).ToArray());
            }

            Console.WriteLine("Done");
            Console.ReadLine();
        }
    }
Exemplo n.º 23
0
 static void Main(string[] args)
 {
     BenchmarkSwitcher
     .FromTypes(new[] { typeof(CompressionOverheadBenchmarks) })
     .Run(args);
 }
Exemplo n.º 24
0
 static void Main(string[] args)
 {
     BenchmarkSwitcher.FromTypes(new[] {
         typeof(Pbkdf2Bench),
     }).Run(args);
 }
Exemplo n.º 25
0
 static void Main()
 {
     BenchmarkSwitcher.FromTypes(new[] { typeof(Brainf_ckBenchmark_Short), typeof(Brainf_ckBenchmark_Long) }).RunAllJoined();
 }
Exemplo n.º 26
0
 static void Main(string[] args) => BenchmarkSwitcher.FromTypes(new[] { typeof(Program) }).Run(args);
Exemplo n.º 27
0
        public static async Task Main(string[] args)
        {
            if (args.Length >= 1)
            {
                BenchmarkSwitcher.FromTypes(new[]
                {
                    typeof(Comparison),
                    typeof(LogMessagesCompression),
                    typeof(LogMessagesSerialization)
                }).Run(args);
                return;
            }

            Logger.Info("Configuring SQL caches...");
            MySqlCache.DefaultInstance.Settings.ConnectionString      = ConfigurationManager.ConnectionStrings[nameof(MySql)].ConnectionString;
            PostgreSqlCache.DefaultInstance.Settings.ConnectionString = ConfigurationManager.ConnectionStrings[nameof(PostgreSql)].ConnectionString;
            SqlServerCache.DefaultInstance.Settings.ConnectionString  = ConfigurationManager.ConnectionStrings[nameof(SqlServer)].ConnectionString;

            OracleCache.DefaultInstance.Settings.CacheSchemaName       = "CARAVAN";
            OracleCache.DefaultInstance.Settings.CacheEntriesTableName = "CRVN_KVL_ENTRIES";
            OracleCache.DefaultInstance.Settings.ConnectionString      = ConfigurationManager.ConnectionStrings[nameof(Oracle)].ConnectionString;

            PersistentCache.DefaultInstance.Settings.CacheFile = Path.GetTempFileName();

            Logger.Info("Running vacuum on SQLite persistent cache...");
            PersistentCache.DefaultInstance.Vacuum();

            Logger.Info("Generating random data tables...");
            _tables        = GenerateRandomDataTables();
            _tableListSize = GetObjectSizeInMB(_tables);

            Logger.Info($"Table count: {TablesCount}");
            Logger.Info($"Row count: {RowCount}");
            Logger.Info($"Total table size: {_tableListSize:0.0} MB");

            Logger.Info("Generating random log messages...");
            _logMessages     = LogMessage.GenerateRandomLogMessages(LogMessagesCount);
            _logMessagesSize = GetObjectSizeInMB(_logMessages);

            Logger.Info($"Log messages count: {TablesCount}");
            Logger.Info($"Total log messages size: {_logMessagesSize:0.0} MB");

            var caches = new ICache[]
            {
                MemoryCache.DefaultInstance,
                MySqlCache.DefaultInstance,
                //OracleCache.DefaultInstance,
                PostgreSqlCache.DefaultInstance,
                SqlServerCache.DefaultInstance,
                PersistentCache.DefaultInstance,
                VolatileCache.DefaultInstance
            };

            var asyncCaches = caches.Cast <IAsyncCache>().ToArray();

            for (var i = 0; i < IterationCount; ++i)
            {
                /*** STORE EACH LOG MESSAGE ASYNC ***/

                await FullyCleanCachesAsync();

                foreach (var asyncCache in asyncCaches)
                {
                    await StoreEachLogMessageAsync(asyncCache, i);
                }

                /*** STORE EACH DATA TABLE ASYNC ***/

                await FullyCleanCachesAsync();

                foreach (var asyncCache in asyncCaches)
                {
                    await StoreEachDataTableAsync(asyncCache, i);
                }

                /*** STORE AND RETRIEVE EACH DATA TABLE TWO TIMES ASYNC ***/

                await FullyCleanCachesAsync();

                foreach (var asyncCache in asyncCaches)
                {
                    await StoreAndRetrieveEachDataTableAsync(asyncCache, i);
                }

                /*** STORE EACH DATA TABLE ***/

                FullyCleanCaches();
                foreach (var cache in caches)
                {
                    StoreEachDataTable(cache, i);
                }

                /*** STORE EACH DATA TABLE TWO TIMES ***/

                FullyCleanCaches();
                foreach (var cache in caches)
                {
                    StoreEachDataTableTwoTimes(cache, i);
                }

                /*** REMOVE EACH DATA TABLE ***/

                FullyCleanCaches();
                foreach (var cache in caches)
                {
                    RemoveEachDataTable(cache, i);
                }

                /*** REMOVE EACH DATA TABLE ASYNC ***/

                await FullyCleanCachesAsync();

                foreach (var asyncCache in asyncCaches)
                {
                    await RemoveEachDataTableAsync(asyncCache, i);
                }

                /*** PEEK EACH DATA TABLE ***/

                FullyCleanCaches();
                foreach (var cache in caches)
                {
                    PeekEachDataTable(cache, i);
                }

                /*** RETRIEVE EACH DATA TABLE ***/

                FullyCleanCaches();
                foreach (var cache in caches)
                {
                    RetrieveEachDataTable(cache, i);
                }

                /*** RETRIEVE EACH DATA TABLE ITEM ***/

                FullyCleanCaches();
                foreach (var cache in caches)
                {
                    RetrieveEachDataTableItem(cache, i);
                }

                /*** RETRIEVE EACH DATA TABLE ASYNC ***/

                await FullyCleanCachesAsync();

                foreach (var asyncCache in asyncCaches)
                {
                    await RetrieveEachDataTableAsync(asyncCache, i);
                }

                /*** STORE DATA TABLES LIST ***/

                FullyCleanCaches();
                foreach (var cache in caches)
                {
                    StoreDataTableList(cache, i);
                }

                /*** STORE EACH DATA TABLE TWO TIMES ASYNC ***/

                await FullyCleanCachesAsync();

                foreach (var asyncCache in asyncCaches)
                {
                    await StoreEachDataTableTwoTimesAsync(asyncCache, i);
                }
            }

            FullyCleanCaches();

            Console.WriteLine();
            Console.Write("Press any key to exit...");
            Console.Read();
        }
Exemplo n.º 28
0
 static void Main(string[] args)
 {
     BenchmarkSwitcher.FromTypes(new[] { typeof(Program) }).RunAll();
     Console.ReadKey();
 }
Exemplo n.º 29
0
 static void Main()
 {
     BenchmarkSwitcher.FromTypes(Assembly.GetExecutingAssembly().GetTypes()
                                 .Where(t => t.IsSubclassOfRawGeneric(typeof(BenchmarkBase <>))).ToArray()).RunAllJoined();
     Console.ReadKey();
 }