mercredi 29 août 2018

Performance difference between if(x) {return;} DoSth(); and if(!x) {DoSth();}

Just had to decompile my old code and i'm used to write it this way:

if(!x)
{
  DoSth();
}

but the decompiler always wrote it this way if there is no code after the snippet:

if(x)
{
  return;
}

DoSth();

Is there any performance advantage in calling return like in the lower code snippet or is it just a personal preference thing?

Aucun commentaire:

Enregistrer un commentaire