I don't think one can refer to this approach as inefficient. Clearly this produces a different output as sin(): The sin() function will produce a curve while this function produces "triangles". So it is really up to you: Do you want your colors to transition "triangly", or "sinely"? hehe
A note on this, however: if I call switchback() with the blue component, and that blue reaches 255, you invert the direction, but what if the next call comes with the red component?? Even worse: What if the red component == 0? You'll leave it as -1 and you will swap again. Just something to have in mind.