Beispiel #1
0
        public void PerfTest()
        {
            int count = 1000;
            var list  = Array.CreateInstance(typeof(byte[]), count) as byte[][];//;//>(count);
            var hList = new Md5Hash[count];

            hList.Initialize();
            var random = new Random();

            for (int i = 0; i < list.Length; i++)
            {
                var bytes = new byte[5];
                random.NextBytes(bytes);
                list[i] = bytes;
            }
            var dateTime = DateTime.Now;

            for (int i = 0; i < hList.Length; i++)
            {
                var hash = Md5Hash.Calculate(list[i]);
                hList[i] = hash;
            }
            var seconds = (DateTime.Now - dateTime).TotalSeconds;

            Console.WriteLine(seconds);
            Console.WriteLine(Math.Round(hList.Length / seconds));
        }