> Note
> ----
> Goto jumping is O(1) if getting to the jump destination doesn't require
> a hash lookup due to "wuring" of the destination at compile time. If a
> hash lookup is required then it is probably something like O(lg n) which
> is still superior in efficiency to O(n). Additionally, while it is true
> that an O(lg n) lookup might be necessary at compile time to find the
> pointer to the labeled code block, this is a one time event and has
> little bearing on the efficiency overall when during runtime the goto
> might be hit thousands or millions of times.
>
*this* implementation of GOTO requires a hash lookup, however it could be
reworked to use the same backpatching as the ZEND_JMP ops used with
conditional statements.  While doing that would speed execution time by
skipping the hash lookup, it'd slow compile time and remove the ability to
use complex expressions as goto targets (i.e.  goto "foo$i"; ).

-Sara

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to