I am trying to improve the performance of my application. Currently, I have the following code in place which iterates more than 1000 times:
if(!condition){
switch(const) {
case one : value = x; break;
case two : value = y; break;
}
} else {
switch(const) {
case one : value = p; break;
case two : value = q; break;
}
}
If I refactor the code as follows will it improve performance?
switch(const) {
case one : condition ? value = p : value = x; break;
case two : condition ? value = q : value = y; break;
}