switch
usually gets translated into a lookup table by the compiler, if possible. So lookup of an arbitrary case is O(1), instead of actually doing a few case comparisons before finding the one you want.
So in many cases an if
/else if
chain will be slower. Depending on the frequency with which your cases are being hit that may make no difference, though.