|
Posted by Robert Cummings on 06/07/05 21:31
On Tue, 2005-06-07 at 14:26, John Nichel wrote:
> Jay Blanchard wrote:
> <snip>
> > The speed difference is negligible though, in this day and age,
> > dependent upon how much hair-splitting you would care to do. You're
> > still setting aside a block of code which will have to be parsed and you
> > incur the same setup if the goto section is the same code as the
> > function. The overhead is introduced in the calling of the function. But
> > we're splitting hairs here :)
> </snip>
>
> Ah, but goto isn't really the same as a function. Functions are along
> the lines of gosub.
>
> *not to be left out on the splitting of hairs ;)
A more realistic speed hit is the fact that using if/elseif/else or
switch statements requires on average an O( n ) lookup, whereas a proper
goto implemention is O( 1 ). Now I'll give you you could do an label to
function map and use that instead, but that's still O( 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. |
`------------------------------------------------------------'
Navigation:
[Reply to this message]
|