From: "Mauricio Fernández" Date: 2002-08-29T09:06:58+09:00 Subject: Re: Temporary VALUE Needs to Be Protected? On Thu, Aug 29, 2002 at 08:51:44AM +0900, Christian Szegedy wrote: > William Djaja Tjokroaminata wrote: > >Hi, > > > >Yes, I probably feel the same way as you do. The more I know about the > >extent of the Ruby garbage collector, the more concerned I am with its > >impact on execution performance. > > > >I think I am using Ruby in some sense not in its original intended > >purpose. For my current application, I am using Ruby more like "a user > >interface" then a full-blown programming tool. The core computation is > >done in C and therefore for efficiency purpose I have moved a lot of data > >to C struct members instead of Ruby's "@" internal data. > > > >As I am trying to separate Ruby object model from its memory management, > >issues like this really come out. Has anybody really done a C programming > >in the presence of a (mark & sweep) garbage collector (besides doing C > >programming within the scripting languages)? > > > >Regards, > > > >Bill > >============================================================================ > >Mauricio Fern?ndez wrote: > > > >>On Wed, Aug 28, 2002 at 06:03:41PM +0900, Christian Szegedy wrote: > >> > >>>The Ruby garbage collector scans the used part of the stack, > >>>and registers all addresses found there. This may be too much, > >>>but it does not matter. (That was matzs commment about the > >>>"conservativness of the gc") > >> > > > >>What is the performance impact of Ruby's GC being conservative? > >><=> How large is the C-stack usually? > > > > > >>Couldn't we use some preprocessor-magic to mark the pointers as they're > >>created? > > > > I don't have not made any tests but my intuition says that under normal > circumstances, the size of the (used part of) stack must be fairly > negligible compared to the heap, therefore, it should not make > significant overhead. That's what I thought, we just have to avoid alloca when the GC is about to do its job. If Ruby were interfaced with C++ we could have a special ValueReference type which would (un)register the pointer as needed, so that a full stack marking wouldn't be needed. -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com There are 3 kinds of people: those who can count & those who can't. -- Unknown source