vendredi 25 septembre 2015

C#, Are negated conditions in If statements faster?

I have a colleague in work who is arguing with me that negated conditions are faster when used in if statements. I have argued back that the compiler is optimizing the code and we don't really know how this condition will actually end.

For example, she is claiming that

if(!MyCondition)

is faster than

if(MyCondition)

I have searched and could not find a reference for this anywhere. So, my question is:

Is there really any preference to improve performance when using conditions inside if statements? Or it's just a matter of better readability?

Aucun commentaire:

Enregistrer un commentaire