[UPHPU] faster? switch, if, or variable function

Jonathan Duncan jonathan at bluesunhosting.com
Thu Aug 9 09:09:44 MDT 2007


On 09 Aug 2007, at 09:05, Jonathan Duncan wrote:

>
> 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?
>


One other thing, a quick google found these two threads indicating  
that switch may be faster:

http://www.webhostingtalk.com/archive/index.php/t-394298.html

http://codingforums.com/archive/index.php?t-68860.html



More information about the UPHPU mailing list