I have a 'For' loop I need to run from 0 to 2,147,483,647 (int.MaxValue). Inside the loop I'm calling a method that calculates a very complex equation and it returns the value for each parameter. I wish to get the highest return value.
The total runtime of my for loop takes about full 24 hours. How and can I reduce the runtime of my code to only one hour? Maybe 4 hours if I will use distributed computing?
static void Main(string[] args)
{
CheckValuesZeroToMaxInt();
Console.ReadLine();
}
private static void CheckValuesZeroToMaxInt()
{
for (int i = 0; i < int.MaxValue; i++)
{
ComplexMath(i);
}
}
I know how to use 'Parallel.For', but still this offers very little help. How can I take my c# code and run it on a cluster of computers to get the return value from my method in no time? Is there a site that offers this service for a low or free cost?