In the realm of performance which is consider more efficient?:
A small switch statement consisting of under 3 cases/below 3 cases? Or A small if chain consisting of under 3 conditions/below 3 conditions?
For example:
int x = 1;
switch (x) {
case 1:
//....do something
case 2:
//....do something
case 3:
//....do something
}
Or
int x = 1:
if (x == 1) {
//....do something
}
else if (x == 2) {
//....do something
}
else if (x == 3) {
//....do something
}
Are both considered equally efficient? Or does one dominate the other via speed?