Date: 11/20/00
- Next message: Andrei Zmievski: "Re: [PHP-DEV] Calling symbol table patch"
- Previous message: Sterling Hughes: "Re: [PHP-DEV] Calling symbol table patch"
- In reply to: Andrei Zmievski: "Re: [PHP-DEV] Calling symbol table patch"
- Next in thread: Andrei Zmievski: "Re: [PHP-DEV] Calling symbol table patch"
- Reply: Andrei Zmievski: "Re: [PHP-DEV] Calling symbol table patch"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 23:34 20/11/2000, Andrei Zmievski wrote:
>On Mon, 20 Nov 2000, Zeev Suraski wrote:
> > Well, a stack push is a considerable slowdown. How much it slows things
> > down exactly obviously depends on your script...
>
>Oh, come on.
>
>ZEND_API inline void zend_ptr_stack_push(zend_ptr_stack *stack, void *ptr)
>{
> if (stack->top >= stack->max) { /* we need to allocate more memory */
> stack->elements = (void **) erealloc(stack->elements,
> (sizeof(void *) * (stack->max *= 2 )));
> stack->top_element = stack->elements+stack->top;
> }
> stack->top++;
> *(stack->top_element++) = ptr;
>}
>
>Most of the time, stack->top is less than stack->max (because max = 64
>on initialization), so all you are executing is the last two statements.
>
>I don't think your argument is very strong as far as performance is
>concerned.
It's there. I didn't say it's strong, but I expect it to be strong much
more often than when this functionality is useful... At any rate, the real
argument against it is the fact that it's hackish. I could probably live
with the slowdown (even though Andi probably wouldn't :)
>Yes, it does, but the only way around it is what you described up above
>and it doesn't really look that appealing. If it was C/C++, I could
>write a macro or something else, but with PHP, we don't have that. So,
>I'm not sure what the solution is.
I agree with you. I don't have a very good solution to give you... I
think that weighting all of the factors, the right thing to do would be
supplying your function with the local symbol table at call time. It's a
bit clumsy for your specific purpose, but the alternatives are worse, in my
opinion.
Zeev
-- Zeev Suraski <zeev <email protected>> CTO, Zend Technologies Ltd. http://www.zend.com/-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Andrei Zmievski: "Re: [PHP-DEV] Calling symbol table patch"
- Previous message: Sterling Hughes: "Re: [PHP-DEV] Calling symbol table patch"
- In reply to: Andrei Zmievski: "Re: [PHP-DEV] Calling symbol table patch"
- Next in thread: Andrei Zmievski: "Re: [PHP-DEV] Calling symbol table patch"
- Reply: Andrei Zmievski: "Re: [PHP-DEV] Calling symbol table patch"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

