A new micro project: comparing performances between 'switch' and if-else-if-else in C++
- POST
I was having an argument with a coworker about the fastest method to branch in a code: lots of if/Else or a switch/case. I figured that the switch case would be faster, because the compiler would be less constrained than with the if/else, and could therefore use a better algorithm to select the right execution path.
To check this, I made a new entry in my microprojects repo, the aptly named switchVsIfElse.