Re: Re: #20993 [Ver]: Element valuechangeswithoutasking
| From: | Andi Gutmans | Date: | Wed, 18 Dec 2002 05:11:49 +0000 |
| Subject: | Re: Re: #20993 [Ver]: Element valuechangeswithoutasking | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-92569@lists.php.net to get a copy of this message | ||
At 12:49 AM 12/17/2002 +0900, Moriyoshi Koizumi wrote:
Andi Gutmans <andi@zend.com> wrote: I don't understand what you're doing here. Are you actually separating on every assignment and doing a deep copy? What I'm trying to do in my patch can be divided into two phases. In the first phase, it checks whether the array contains any referenced elements (of course it does nothing and return SUCCESS if the passed zval is a non-array value). If such an element exists, then entering the second phase, separates the array zval and duplicates each referenced element while it doesn't make copies, but only increments the refcount for non-referenced elements.OK so that's a deep copy. As much as I understand the motivation I don't think this should be done. It'll slow down lots of things in PHP. I think this should be solved by documentation. Andi
Moriyoshi Andi At 04:09 PM 12/15/2002 +0900, Moriyoshi Koizumi wrote:Oops, the patch was wrong as the runtime occationally segfaults in a case like: <?php $a = 0; $a = &$a; /* is_ref=1, refcount=1 */ ?> Attached is the revised patch. Please try it out. And the result of a tiny benchmark follows: [Before patching] 1: 0.263245 2: 0.142505 3: 0.328045 4: 0.137149 [After patching] 1: 0.273811 2: 0.141965 3: 0.699429 4: 0.137010 MoriyoshiZeev/AndiMy proposal, was based on 2 things: fix or document. I'm surehad abettergood reason not to always separate, and that probably is performance. IF this impacts overall performance very negatively, then maybe thechoice is to document it. I'll try the patch though. With kind regards, Melvyn Sopacua <?php include("not_reflecting_employers_views.txt"); ?> -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php