I have a program that runs billions of calculations and I'm trying to get it to run faster. In my program, I declare a lot of variables for intermediate calculations. For example, in pseudo code:
public bool FunctionThatGetsCalledInMain(manyparameters)
{
for (int i = 0; i < 10000000; i++)
{
int x = bigFunctionThatReturnsAnInt(manyparameters)
double y = bigFunctionThatReturnsADouble(manyparameters)
string z = bigFunctionThatReturnsAString(manyparameters)
bool b = someFunctionOfXYZ(x,y,z)
}
}
I'm wondering if I can improve performance by doing something like:
public bool FunctionThatGetsCalledInMain(manyparameters)
{
for (int i = 0; i < 10000000; i++)
{
bool b = someFunctionOfXYZ(bigFunctionThatReturnsAnInt(manyparameters),bigFunctionThatReturnsADouble(manyparameters),bigFunctionThatReturnsAString(manyparameters))
}
}
I know it looks horrendous, but I really need to cut the time. Not sure if this theoretically makes a difference at all.
Aucun commentaire:
Enregistrer un commentaire