Exemplo n.º 1
0
        public void TestEach()
        {
            string tempFilename = Path.GetTempFileName();

            using (var links = new Links(tempFilename, DefaultLinksSize))
            {
                ulong counter = 0;

                Console.WriteLine("Testing Each function.");

                Stopwatch sw = Stopwatch.StartNew();

                links.Each(0, 0, x =>
                {
                    counter++;

                    return true;
                });

                TimeSpan elapsedTime = sw.Elapsed;

                double linksPerSecond = counter / elapsedTime.TotalSeconds;

                Console.WriteLine("{0} Iterations of Each's handler function done in {1} ({2} links per second)",
                    counter, elapsedTime, (long)linksPerSecond);
            }

            File.Delete(tempFilename);
        }