Is there an efficiency preference for one of the following control flow options for use in a loop or switch over the other?
Option 1:
switch(...){
case 1:
if (...) { ... }
else if (...) { ... }
else if (...) { ... }
.
.
.
else if (...) { ... }
break;
case 2:
.
.
.
}
Option 2:
switch(...){
case 1:
if (...) { ... break; }
if (...) { ... break; }
.
.
.
if (...) { ... break; }
case 2:
.
.
.
}
No. Any sane compiler will generate to the same output (assembly, bytecode, etc). for both.
You can demonstrate this using
gcc -Sto generate assembly for both versions.