Performance improvement by removing Switch statements in compiler