MB>>typedef struct _zend_object_value {
MB>>        zend_object_handle handle;
MB>>        zend_object_handlers *handlers;
MB>>} zend_object_value;
MB>>
MB>>And wouldn't it be faster to drop both handlers from the table and
MB>>instead have zend_object_value have a pointer to zend_class_entry
MB>>and that a pounter to the handler table?

Not quite - since not all objects have zend_class_entry for them so you 
couldn't actually use it - unless you insert check each time _and_ write 
code to handle _both_ cases - using zend_class_entry pointer and using 
something else - so it's actually easier to do the right thing from the 
start and use the handlers. Of course, you could "optimize" it for the 
case zend_class_entry exists and add the zend_class_entry field into the 
object value - but IMHO the resulting code and model complication would do 
much more harm than speed improvement on saving one function call (which 
I'm not sure is of any significance). Also, this would inevitably lead to 
creating code which forgets to use handlers and breaks in all kinds of 
funny ways on overloaded objects. My opinion is that it is better to have 
one consistent API.

As for the question why there are two handlers - because class name is 
useful in all kinds of contexts like backtaces, exceptions, messages, etc. 
even though you may not have zend_class_entry - so it's a possibility for 
the overloaded object to give maximum iformation there. 
-- 
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/ +972-3-6139665 ext.115

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

Reply via email to