コード例 #1
0
ファイル: Program.cs プロジェクト: modulexcite/ecsharp
        private static void RunBenchmarks()
        {
            new ListBenchmarks().Run(EzChartForm.StartOnNewThread(true));

            Benchmarks.ConvexHull();

            // Obtain the word list
            string wordList = Benchmark.Resources.Resources.WordList;

            string[] words = wordList.Split(new string[] { "\n", "\r\n" },
                                            StringSplitOptions.RemoveEmptyEntries);

            Benchmarks.LinqVsForLoop();
            //Benchmarks.CountOnes();
            Benchmarks.BenchmarkSets(words);
            Benchmarks.ThreadLocalStorage();
            Benchmarks.EnumeratorVsIterator();
            GoInterfaceBenchmark.DoBenchmark();
            CPTrieBenchmark.BenchmarkStrings(words);
            CPTrieBenchmark.BenchmarkInts();
            Benchmarks.ByteArrayAccess();
        }
コード例 #2
0
        public static void Main()
        {
            // Obtain the word list
            string wordList = Benchmark.Resources.Resources.WordList;

            string[] words = wordList.Split(new string[] { "\n", "\r\n" },
                                            StringSplitOptions.RemoveEmptyEntries);

            RunMenu(new Pair <string, Action>[] {
                new Pair <string, Action>("Convex Hull", Benchmarks.ConvexHull),
                new Pair <string, Action>("Run unit tests of LeMP", Benchmarks.LinqVsForLoop),
                new Pair <string, Action>("Hashtrees (InternalSet) vs HashSet/Dictionary", () => Benchmarks.BenchmarkSets(words)),
                new Pair <string, Action>("Thread-local storage", Benchmarks.ThreadLocalStorage),
                new Pair <string, Action>("IEnumerator<T> vs Iterator<T>", Benchmarks.EnumeratorVsIterator),
                new Pair <string, Action>("GoInterface", GoInterfaceBenchmark.DoBenchmark),
                new Pair <string, Action>("CPTrie (strings)", () => CPTrieBenchmark.BenchmarkStrings(words)),
                new Pair <string, Action>("CPTrie (integers)", CPTrieBenchmark.BenchmarkInts),
                new Pair <string, Action>("Byte array access", Benchmarks.ByteArrayAccess),
                new Pair <string, Action>("List benchmarks (with chart Form)",
                                          () => new ListBenchmarks().Run(EzChartForm.StartOnNewThread(true))),
            });
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: amenzies/Embree.NET
        /// <summary>
        /// Entry point - pass "verbose" as a command-line
        /// argument to initialize Embree in verbose mode.
        /// </summary>
        public static int Main(String[] args)
        {
            try
            {
                var verbose = (args.Select(s => s.ToLower()).Contains("verbose"));
                if (verbose)
                {
                    args.Select(s => s != "verbose"); // Clean up arglist
                }
                ParseCommandLineArguments(args);      // For selecting ray packet sizes

                if (verbose)
                {
                    Console.WriteLine("Embree.NET Benchmark [VERBOSE]");
                    Console.WriteLine("==============================");
                    RTC.Register("verbose=999"); // max verbosity?
                }
                else
                {
                    Console.WriteLine("Embree.NET Benchmark");
                    Console.WriteLine("====================");
                }

                Console.WriteLine(""); // this is for debugging
                Console.WriteLine("[+] " + Bits + "-bit mode.");

                // Note this is similar to the original Embree benchmark program
                Console.WriteLine("[+] Performance indicators are per-thread.");

                {
                    // Benchmark parameters
                    int w = 1024, h = 1024;

                    Console.WriteLine("[+] Benchmarking intersection queries.");

                    foreach (var item in Benchmarks.Intersections(SceneFlags.Static, Flags, 501, w, h))
                    {
                        Measure(item.Item2, item.Item3, (s) => Console.WriteLine("    {0} = {1}", item.Item1.PadRight(35), s));
                    }

                    Console.WriteLine("[+] Benchmarking occlusion queries.");

                    foreach (var item in Benchmarks.Occlusions(SceneFlags.Static, Flags, 501, w, h))
                    {
                        Measure(item.Item2, item.Item3, (s) => Console.WriteLine("    {0} = {1}", item.Item1.PadRight(35), s));
                    }
                }

                /*{
                 *  Console.WriteLine("[+] Benchmarking geometry manipulations.");
                 *
                 *  foreach (var item in Benchmarks.Geometries(SceneFlags.Static, Flags))
                 *      Measure(item.Item2, item.Item3, (s) => Console.WriteLine("    {0} = {1}", item.Item1.PadRight(35), s));
                 * }*/

                if (verbose)
                {
                    RTC.Unregister();
                }

                return(EXIT_SUCCESS);
            }
            catch (Exception e)
            {
                var msg = e is AggregateException ? e.InnerException.Message : e.Message;
                Console.WriteLine(String.Format("[!] Error: {0}.", msg));
                Console.WriteLine("\n========= STACK TRACE =========\n");
                Console.WriteLine(e.StackTrace);
                return(EXIT_FAILURE);
            }
        }