예제 #1
0
        public void GetHashCode(ComparerData data)
        {
            var setting1 = new TypicalSetting
            {
                Name    = "Johan Larsson",
                Dummies = Enumerable.Range(0, 1).Select(x => new DummySerializable(x)).ToList(),
                Value1  = 1.2,
                Value2  = 2,
                Value3  = 3,
                Value4  = 4,
                Value5  = 5,
            };

            var comparer = XmlEqualsComparer <TypicalSetting> .Default;
            var warmup   = comparer.GetHashCode(setting1);
            var sw       = Stopwatch.StartNew();

            for (var i = 0; i < data.Times; i++)
            {
                var result = comparer.GetHashCode(setting1);
            }

            sw.Stop();
            Console.WriteLine(
                "{0}.GetHashCode(_setting1) {1} times took: {2} ms total ({3} ms each)",
                data.ComparerName,
                data.Times,
                sw.ElapsedMilliseconds,
                sw.Elapsed.TotalMilliseconds / data.Times);
        }
예제 #2
0
        public void GetHashCode(ComparerData data)
        {
            var comparer = XmlEqualsComparer <TypicalSetting> .Default;
            var warmup   = comparer.GetHashCode(_setting1);
            var sw       = Stopwatch.StartNew();

            for (int i = 0; i < data.Times; i++)
            {
                var result = comparer.GetHashCode(_setting1);
            }
            sw.Stop();
            Console.WriteLine(
                "{0}.GetHashCode(_setting1) {1} times took: {2} ms total ({3} ms each)",
                data.ComparerName,
                data.Times,
                sw.ElapsedMilliseconds,
                sw.Elapsed.TotalMilliseconds / data.Times);
        }