Re: GOTO operator

From: Date: Fri, 30 Jul 2004 19:11:25 +0000
Subject: Re: GOTO operator
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  Groups: php.internals 
Request: Send a blank email to internals+get-11714@lists.php.net to get a copy of this message
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. | `------------------------------------------------------------'

« previous php.internals (#11714) next »