Performance

As mentioned above, using a switch or select case in place of a long series of else ifs can produce a jump table in place of a series of comparisons, which could profoundly impact program speed.

Other than that, conditionals don't generally have a big impact on performance. Small gains are possible from an understanding of human nature. Studies have shown that if conditions among randomly selected programs are false around 60% of the time. This is due to our tendency to think of conditions in terms of the less likely outcome. For example, we think about what we will need to do if there is a tornado, not what we must do if there is not a tornado. Perhaps it just seems like less work if we have to think about it less often.

Compiler writers know this, and generally make the else clause the faster case in order to take advantage of it. Because of the way conditionals work at the machine code level, one case or the other will have to perform an extra unconditional branch, which is added overhead:

if ( a == b )
    c = 1;
else
    c = 2;
d = 5;
# The if clause below requires an added "b done" instruction to exit the block
# The else clause is therefore faster.
        cmp     a, b
        bne     else

# If clause (a == b)
        mov     c, 1
        b       done

# Else clause (a != b)
else    mov     c, 2

# First instruction after if block
done    mov     d, 5

Another way to improve performance is simply not using conditionals where they are not needed:

bool    equal;

// We are simply setting the variable equal to the value of the condition
if ( a == b )
    equal = true;
else
    equal = false;
    
// Faster
equal = (a == b);