loading...

re: How do you handle the disposable IF statements ? VIEW POST

FULL DISCUSSION
 

This completely removes the code, using dead code elimination, at compiletime:

when conditionThatsRarelyTrue:
  discard

For runtime alternative, compiler uses branch optimization:

if unlikely(conditionThatsRarelyTrue):
  discard
elif likely(conditionThatsUsuallyTrue):
  discard
else:
  discard

The likely() will be faster, the unlikely() will be slower.
This is Nim lang.

Code of Conduct Report abuse