On Fri, 2004-07-30 at 13:11, Andi Gutmans wrote: > Rob, > > First of all I don't know where you are getting O(n) from because the > operation is O(1). > Secondly, I just don't understand what the sudden necessity for the goto > construct is when over the years we have barely ever had a PHP developer > asking for it. > And please guys, don't use C optimization comparisons as an example. This > doesn't apply to PHP...
Goto is O(1) -- cascading through switch cases till you hit the right one is O(n) where there are n possible cases. Now if I have to run through that damn switch time m times, then my runtime is O(mn) whereas with goto it's O(m). This isn't a C optimization, this is just the best way to do it sometimes. Even if goto was a runtime lookup I'm still better off with O(m lg n). Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php