[chuck-users] GC vs real-time (was Getting Started with ChucK)

Hans Aberg haberg at math.su.se
Fri Jul 24 04:28:17 EDT 2009

On 24 Jul 2009, at 03:19, Kassen wrote:

>> The GC question might be irrelevant, because music does not require  
>> so much power relative graphics, and standard malloc/free is just  
>> perhaps hundred times or even less slower than a fast GC. By  
>> Moore's law (which I checked on Macs), the chip size double every  
>> second year, and for CPU frequency it is about every third. So  
>> combined (using multicore) that gives five doublings in six years.  
>> On the other hand, implementing an advanced GC takes up a lot  
>> programming time.
> I do think GC is relevant. I just don't think the effect of swapping  
> on the time GC takes is that relevant. While we may only rarely need  
> to use so much memory that we run out of RAM at a single moment we  
> may want to use ChucK in a installation that runs for a month. Right  
> now if we want that we'd need to make very sure there is no memory  
> leak which is quite ricky in ChucK right now; I think function calls  
> can leak, for example.

Here I meant ordinary memory malloc/free cleanup as compared to a GC  
which runs at its own times doing it. The latter is faster. The  
malloc() that comes with the C compiler typically takes several tens,  
sometimes hundreds, of cycles for each memory allocation - it has to  
cope with memory fragmentation. A GC can do that much faster, but with  
the collection time problems. But if computers get powerful enough,  
that difference may not of importance to the application at hand.

> CPU usage is a very different matter. Moore's law stopped affecting  
> us much for ChucK which doesn't multi-thread, actually clockspeeds  
> went down a bit.

That is a big problem: Chuck needs to be multi-threaded if it should  
be able to make use of this new computing power.

> I find new laptops in stores right now less appealing than the ones  
> that were there a few years ago...

You pick up a PowerBook at a good price in this point of time, but  
beware that the lids of the Ti-books will drop off after some time of  
use because the hinge-structure is weak. But they can still be used,  
with an external display.

> ...when you could still get a non-wide screen, cardbus and a floppy  
> drive.

I haven't seen a floppy drive for a long time, though they seem to  
have been longer in use on the PC side.

> I may be somewhat unique in that but until I seriously need to run  
> both realtime graphics and realtime sound on the same machine I see  
> no real reason to upgrade to a multi-core at all. To me it's a bit  
> like owning 10 toilets; you'll still only be able to use one at a  
> time.

Multi-core can still be useful if one can run more than one copy of  
the program.


More information about the chuck-users mailing list