Пример #1
0
        public static void Main(string[] args)
        {
            // Settings
            //
            // You can control what benchmarking is done by commenting out
            // tags. A benchmark will only run if all its tags are enabled.
            //
            ISet <Tag> settings = new SetHashLinked <Tag>()
            {
                // Major Tags
                Tag.Algorithms,
                Tag.DataStructures,
                Tag.Diagnostics,
                Tag.Mathematics,
                Tag.Measurements,
                Tag.Parallels,

                // Data Structure Tags
                Tag.Link,            // aka Tuple
                Tag.Indexed,         // aka Array
                Tag.Addable,         // aka List
                Tag.FirstInLastout,  // aka Stack
                Tag.FirstInFirstOut, // aka Queue
                Tag.Heap,
                Tag.AvlTree,
                Tag.RedBlackTree,
                Tag.BTree,
                Tag.SkipList,
                Tag.Set,
                Tag.Map, // aka Dictionary
                Tag.KdTree,
                Tag.Omnitree,
            };

            foreach (Type type in Assembly.GetExecutingAssembly().GetTypes())
            {
                BenchmarksAttribute attribute = type.GetCustomAttribute <BenchmarksAttribute>();
                if (!(attribute is null))
                {
                    var summary = BenchmarkRunner.Run <Program>();
                }
            }
        }
Пример #2
0
        public static void Main()
        {
            foreach (Type type in Assembly.GetExecutingAssembly().GetTypes())
            {
                BenchmarksAttribute attribute = type.GetCustomAttribute <BenchmarksAttribute>();
                if (!(attribute is null))
                {
                    foreach (Tag tag in attribute.Tags)
                    {
                        if (!BenchmarkSettings.EnabledTags.Contains(tag))
                        {
                            goto SkipBenchmark;
                        }
                    }
                    var summary = BenchmarkRunner.Run(type);
                }
SkipBenchmark:
                continue;
            }
        }