On Thu, 2004-07-29 at 11:04, Sara Golemon wrote:
> > 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"; ).

I'm not sure whether this is feasible or not, but perhaps a mix of
compile-time/runtime logic is possible. If the argument of the goto is a
literal then a compile-time jump hook is created, otherwise the argument
is evaluated at run-time. This would provide the best of both worlds,
but as I said I have no idea as to its feasibility.

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

Reply via email to