When profiling a program written in any language, do not focus on language structures, but rather focus on what your code does. Enter the code, find out where the time is spent, then you will know the reason, because it would be narrowed.
If you know that the slow parts of your program are in your if statement, then you already know the answer to your question.
I am posting this as an answer, because I believe that the question of the effectiveness of a particular language function for optimization purposes is a completely wrong approach, and I believe that you will benefit from a different strategy.
In addition, some implementations may handle things a little differently, therefore, if there is no stone in the standard standard (and sometimes that it is not a guarantee), the answer may be implementation dependent and conditional.
Ronald barzell
source share