At 03:59 22.11.2002, Marcus Börger wrote:
In the following link you will find final, public, protected and private (f + 3p) for ZE2:
http://marcus-boerger.de/php/ext/ze2/

What it does:

(...)

- 'speed guys' continued: during compile time (zend_compile.c)

Forgot to complete this section :-)

In function Zend/zend_compile.c/zend_do_inheritance() where functions are inherited i added
additional checks. The old code simple merged the hash tables. I added:
1) for each inherited method: 1*call + 1*comparision + 1*ored_assignment + 1 jump
2) for each overloaded method: 1*call + 3 check blocks
Without errors these blocks do:
2 assignments + 3*jump + 3*test + 3*logical_op
+ optional: 3*test + 1*logical_op + 3*jumps
+ optional: 1* logical_op + 1*ored_assignment

For an *optimizing* compiler and an Intel CPU > PII each number above result in one single instruction.
But you will have to add the stack frames for the calls and assignments require more operations than one
operation.

Above countings are without guarantee because i simply counted what i would expect from expirience....

Optional means when using 3p in certain situations. In other words when not using 3p those are
not executed so i guess the overhead is acceptable.




(...)
- i store abstract in fn_flags to disallow overloading a method with an abstract method. There is no
further change in abstract.
By storing abstract in fn_flags we can have "is_abstract($obj)". The current implementation does not
allow this check.



(...)

What's left:

- create a global scope with a name that can be referred by the error message. Not doing this will
either result in errors when working with "dynaming function call by name" (i guess so) or we have
to check or skip class/namespace names in error messages.

The easiest way would be to avoid problems in error messages would be to use a define
#define SCOPE_NAME(scope) (scope ? scope->name : "")



(...)
- more than i know yet - i guess :-)
is_abstract($obj_or_class_or_method)
is_final($obj_or_class_or_method)
is_private($method)
is_protected($method)
is_public($method)

But those are easy to implement :-)

marcus


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

Reply via email to