On 8/9/07, Wade Preston Shearer <[EMAIL PROTECTED]> wrote: > > If one had a long page of functions (~50) that a script selected only > one from, which would be faster to use: a switch, an if/else > combination, or a variable function call?
Knee jerk reaction is to say switch or if/else but I wonder if variable function call is faster. In a C compiler, a switch ends up doing a comparison just like the if statement. So the difference between those two is not significant. With both the if and switch a comparison is made before you get to the function. If you use the variable function call, there are no comparisons before the function is called. So maybe it is faster. Hmmm. -- Scott Hill "May you solve interesting problems" - Author Unknown "A fanatic is one who can't change his mind and won't change the subject." - Sir Winston Churchill _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
