static void Main()
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("ru-RU");
const int equationCount = 45*1000*1000;
Console.WriteLine("Решаем квадратные уравнения: {0:N0}", equationCount);
Console.WriteLine();
BenchmarkWithoutThreads(equationCount);
Console.WriteLine();
BenchmarkWithThreads(equationCount, 2);
BenchmarkWithThreads(equationCount, 3);
BenchmarkWithThreads(equationCount, 4);
Console.WriteLine();
#region ThreadPriority.Highest
//BenchmarkWithThreads(equationCount, 2, ThreadPriority.Highest);
//BenchmarkWithThreads(equationCount, 3, ThreadPriority.Highest);
//BenchmarkWithThreads(equationCount, 4, ThreadPriority.Highest);
//Console.WriteLine();
#endregion
#region Parallel.For
//Console.Write("Время на решение с помощью Parallel.ForEach: ");
//Stopwatch watch = Stopwatch.StartNew();
//var equations = (new RandomCoeffEnumerator()).Take(equationCount);
//Parallel.ForEach(
// equations,
// new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount },
// eq => { Equation tempEq = eq; Solve(ref tempEq); }
//);
//watch.Stop();
//Console.WriteLine("{0:F4} сек.", watch.Elapsed.TotalSeconds);
#endregion
}