Re: Calling symbol table patch

From: Date: Mon, 20 Nov 2000 21:42:24 +0000
Subject: Re: Calling symbol table patch
References: 1 2 3 4 5 6  Groups: php.dev 
Request: Send a blank email to php-dev+get-38701@lists.php.net to get a copy of this message
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@zend.com> CTO, Zend Technologies Ltd. http://www.zend.com/

« previous php.dev (#38701) next »