Rasmus Lerdorf wrote:
> Sheez, guys, slow down a tad.  Just because he says "no performance
> penalty" in the description, doesn't make it true.  Unless I missed
> something in the patch, I don't see how I would resolve the symbols at
> compile-time now which means it has been moved to the executor and in
> doing so it implies a huge performance penalty.

Hi Rasmus,

I'm actually certain that the patch doesn't change any of the symbol
resolution logic or add any need to move things from the compile-time to
the executor.  This is because the namespace implementation basically
works more like a #define macro to auto-prepend class names and function
names with namespace names.

Old logic:

request start => CG(namespace) = NULL
T_NAMESPACE ...;
zend_do_namespace() => defines CG(namespace) which is used for creating
class and function entries
php junk
compile end => if (CG(namespace)) destruct CG(namespace), CG(namespace)
= NULL

New logic:

request start => CG(namespace) = NULL
[potential php junk]
T_NAMESPACE ... {
zend_do_namespace() => defines CG(namespace) which is used for creating
class and function entries
php junk
}
zend_do_end_namespace() => destruct CG(namespace), CG(namespace) = NULL
php junk (which can include class/function entries, although that's a
terrible idea)
T_NAMESPACE ... {
zend_do_namespace() => defines CG(namespace) which is used for creating
class and function entries
php junk
}
zend_do_end_namespace() => destruct CG(namespace), CG(namespace) = NULL
compile end => if (CG(namespace)) destruct CG(namespace), CG(namespace)
= NULL

In other words, the only difference is that mid-parse the namespace
#define-like prefix can be modified or removed.

Greg

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

Reply via email to