Re: AW: AW: [PHP-DEV] Garbage collector patch
| From: | Derick Rethans | Date: | Wed, 05 Dec 2007 23:12:06 +0000 |
| Subject: | Re: AW: AW: [PHP-DEV] Garbage collector patch | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-33782@lists.php.net to get a copy of this message | ||
On Wed, 5 Dec 2007, Matthias Pigulla wrote:
> > > Is it possible to always perform (unconditionally compile in) the
> > > necessary housekeeping tasks but stick with the current GC, so that
> > > cycle-detection only happens when the user calls a
> > > gc_go_find_cycles()
> > > function? Would that significantly improve the above numbers?
> >
> > Yes, that would be possible, but it wouldn't speed anything up in case
> > you don't have any cycles.
>
> Not sure I got you right. That is, the speed penalty comes from
> housekeeping? Does the new GC try to find cycles automatically
> whenever a refcount goes down to zero?
Not immediately... the algorithm should only run when either the root
buffer is full, or the function is run manually.
> If building and maintaining data structures for the algorithm costs
> only a little memory but speed impact is neglegible unless the
> algorithm actually runs, then you could stick with the
> non-cycle-detecting "legacy" GC (= speed) unless you know you have
> cycles and/or want to trade a little processing time (a call to
> gc_go_find_cycles()) for the memory it will/might free.
Yes, exactly. But it's just as easy to turn automatic cleaning as well -
in that case the find cycle algorithm will kick in at some specific
amount of "freed" vars.
regards,
Derick
--
Derick Rethans
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org