[UPHPU] faster? switch, if, or variable function
Jonathan Duncan
jonathan at bluesunhosting.com
Thu Aug 9 09:05:59 MDT 2007
On 09 Aug 2007, at 08:55, Wade Preston Shearer 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?
OOOH, I like multiple choice questions. Let's see, I have a 33.33%
chance of guessing the correct one...
I would say that they switch and if/else are both the same. The
variable function call would be more elegant and probably use less
code. Overall, I would say that any difference in speed between
these would be miniscule anyway. What are you doing that would make
it matter how many more nanoseconds one control statement is over
another?
Jonathan
More information about the UPHPU
mailing list