Andi Gutmans <[EMAIL PROTECTED]> wrote:

> At 12:49 AM 12/17/2002 +0900, Moriyoshi Koizumi wrote:
> >Andi Gutmans <[EMAIL PROTECTED]> 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.

Yes, according to my trivial benchmark, my patch puts a considerable 
weight on the ZendEngine, to run twice as slowly as the current runtime in 
the worst case. Seems no way, but I suppose it also sounds a reasonable 
penalty of using references.

Moriyoshi

> 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
> > > >
> > > >Moriyoshi
> > > >
> > > > > My proposal, was based on 2 things: fix or document. I'm sure 
> > Zeev/Andi
> > > > had a
> > > > > good reason not to always separate, and that probably is performance.
> > > > >
> > > > > IF this impacts overall performance very negatively, then maybe the 
> > better
> > > > > choice 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
> > >
> 


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

Reply via email to