lundi 25 avril 2016

Which expression is faster

Which of these two expressions is faster when statement is true in 50% of all cases and variable and value are both doubles? And why is it so?

First expression:

if (statement)
    variable += value;

Second expression:

var += statement ? value : 0;

Aucun commentaire:

Enregistrer un commentaire