public static long TimeProcess(Process p) { BulletHell.Time.Timer timer = new BulletHell.Time.Timer(); timer.Reset(); p(); return(timer.Time); }
public static void Main() { LayeredLinkedList <int> lll = new LayeredLinkedList <int>(0, x => (double)x, 1000, 100, 10, 1); BulletHell.Time.Timer time = new BulletHell.Time.Timer(); Random r = new Random(); time.Reset(); long thous = 1000; long million = thous * thous; long billion = thous * million; long trillion = million * million; for (long i = 0; i < 20 * thous; i++) { int j = r.Next(10); lll.Add(j); lll.Remove(j); //lll.Remove(r.Next(10)); //lll.Add(1000 * r.NextDouble()); } Console.WriteLine(lll.Count()); Console.WriteLine(time.Time); //lll.Write(); Console.WriteLine("-------------------------------------------------"); time.Reset(); int count = 0; foreach (double d in lll.ElementsBetween(30, 40)) { count++; } Console.WriteLine(count); count = 0; foreach (double d in lll.ElementsBetween(-100, 5000)) { if (30 < d && d < 40) { count++; } } Console.WriteLine(count); Console.WriteLine(time.Time); Console.ReadKey(); }