[Stackless] Video on channels

olsongt at verizon.net olsongt at verizon.net
Mon Sep 10 15:59:33 CEST 2007


From: Arnar Birgisson <arnarbi at gmail.com>
Date: 2007/09/10 Mon AM 07:47:10 CDT
To: johanc at easypublisher.com
>> In the yield version presented here won't the stack keep growing for
>> each function call?
>
> Yes, absolutely. On my system the stack blows up if goal is >= 999.

For me the stack blew up at 1000 for your version of the program.  I
was able to run the stackless version for 100,000 items using less
than 15 Megs of memory.  I didn't try any higher numbers, but they
should run fine.

To answer Johan's question, the stack won't grow with the stackless
version because tasklets end up going onto the heap.  [That's why they
call it stackless ;-) ] Yes, you will consume more memory as you track
down more primes, but you'd also consume memory with the naive
implementation where you just keep all existing primes in an array.  I
suppose if you're really concerned about memory consumption, each
tasklet does consume more memory than each integer in an array would.

-Grant




More information about the Stackless mailing list