develooper Front page | perl.perl6.language | Postings from February 2001

Re: Garbage collection (was Re: JWZ on s/Java/Perl/)

From:
Jan Dubois
Date:
February 12, 2001 10:50
Subject:
Re: Garbage collection (was Re: JWZ on s/Java/Perl/)
Message ID:
5vbg8to0klq6q9m1tieu00pu94amaf0vl6@4ax.com
On Mon, 12 Feb 2001 13:33:52 -0500 (EST), Sam Tregar <sam@tregar.com>
wrote:

>> It's reasonably obvious (which is to say "cheap") which variables aren't
>> involved with anything finalizable.
>
>Probably a simple bit check and branch.  Is that cheap?  I guess it must
>be.

Yes, but incrementing the reference count is a single inc instruction too,
and todays CPUs are optimized to do those fast too.  I doubt a memory
fetch, bit test and jump instruction is much fast than an memory
increment.

>> Nowhere near double the penalty. We only need to deal with refcounts when
>> references are actually taken, assigned, or destroyed. That's a rare
>> occurrence, relatively speaking.
>
>Perhaps.  It's not rare in OO Perl which is coincidentally one area in
>serious need of a speedup.  I suppose I'm warped by my own experience -
>all the code I see every day is filled with references and objects.
>That's probably not the average case Perl usage.

I don't think so.  Most Perl code nowadays makes heavy use of modules and
man modules are written in OO fashion.  But reference counting is *not*
what makes Perl method calls so slow.

-Jan




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About