[plt-scheme] Some thoughts about GC and realtime aplications

From: John Clements (clements at brinckerhoff.org)
Date: Fri May 19 14:23:41 EDT 2006

On May 19, 2006, at 11:09 AM, Ivan Boulanov wrote:

> Thank you for all your answers. You gave me very interesting  
> information and I wonder why all these references have not been yet  
> included to Scheme Wiki. It is a very, very interesting things  
> especially for a little (beginner) schemer.
> Joe Marshall wrote:
>> 3.  Modern computers have *lots* of RAM.
> If we treat such a techinical things relatively, we come to  
> conclusion that there is no relative advantage for modern PCs over  
> ancient ones. The more RAM amount and CPU time we get, the more we  
> waste. It is a banality. The question is how competitive would be a  
> game with GC to those that use manual memory management? Modern big  
> games (The Elder Scrolls III, Doom 3 etc.) have a very strong  
> demands on how fast resources have to be allocated and how fast  
> have to be freed. Modern games can not allow to waste a huge amount  
> of RAM just because GC techique requires this. I think there really  
> have to be a hybrid high-performance approach. I should consult the  
> given references.

One mistake here: don't confuse "uses lots of ram" with "runs  
slowly".  In fact, the _opposite_ can be true; that is, in a gc  
system you may be trading compactness for speed.  If I have lots of  
ram, then I don't need to spend all my time making sure I don't  
overflow a tiny little box.  To use a possibly inappropriate  
metaphor, a factory with lots of floor-space will probably produce  
things _faster_ than one that has a tiny footprint, because the extra  
space allows the factory to optimize processes by taking more space.

> And also you wrote:
>>> A completely different approach is to use reference-counting  
>>> instead of GC.
>>> This approach is similar to the modern C++ programming approach  
>>> of smart
>>> pointers.
>> This, I think, is the wrong approach.  If you trace a program that
>> uses reference
>> counts, you'll notice that it spends a good chunk of time  
>> incrementing and
>> decrementing the refcounters.  This is spread rather evenly  
>> throughout the
>> program, so it doesn't introduce noticable pauses, but it does  
>> take up processor
>> time.
> I don`t really believe in that because I use smart pointers (read  
> as "reference counting") everywhere I can and there is only a  
> negligible overhead over raw pointers. Maybe I miss something?

Both argument and counterargument here are in need of support; surely  
there's lots of work on the time taken by reference-counting in  
various programs?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20060519/290d2a7c/attachment.p7s>

Posted on the users mailing list.