[plt-scheme] graphs / shared / memory!!

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Oct 20 20:56:26 EDT 2005

On Oct 20, 2005, at 8:24 PM, Yoav Goldberg wrote:

>>>> Have you actually measured the memory consumption disadvantaged 
>>>> before
>>>> you jump to this conclusion?
> Ok. I stand corrected.

Good. Now sit down and let's think.

> My little benchmark[*] proved without a doubt that lists are far more
> efficient -- about 9mb mem usage for mzscheme using lists, while the
> streams version got to about 150mb mem usage (and run for quite a
> while!) when I killed the proccess.

It is difficult to make lazy programs run reasonably efficiently.
The Miranda(tm)/Haskell community needed two decades. (And that
means you're within a factor of 2 of average C programs and worse
when compared to Fortran.)

> (I wonder how Python's generators will match up.. I might write a
> python version tomorrow..)

Python uses reference counting. I'd say you start with
the circular graph version. Last time I talked to Guido
he didn't understand the value of garbage collection.

-- Matthias


> Yoav
>
> [*] streams-version (list version is the same but with list
> operations, list-repeat-n uses recursive calls to append):
>
> (define s1
>   (stream-append
>      (stream-repeat-n 1000 (stream 0 1 2 3 4 5 6 7 8 9))
>      (stream 9 9 9 9)
>      (stream-repeat-n 1000 (stream 0 1 2 3 4 5 6 7 8 9))))
> (define s2
>   (stream-repeat-n 10011 (stream -1 1)))
> (define s3 (stream-map * s1 s2))
> (stream->list s3)
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.