[plt-scheme] graphs / shared / memory!!
> >> Have you actually measured the memory consumption disadvantaged before
> >> you jump to this conclusion?
Ok. I stand corrected.
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.
(I wonder how Python's generators will match up.. I might write a
python version tomorrow..)
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)