<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi,<div><br></div><div>This week, I have implemented streams as described in SICP in Erlang. I have used Eratosthenes's sieve as a test case, as described in SICP. I already had the same algorithm in scheme.</div><div><br></div><div>My implementation of force and delay in Erlang is the most basic using a thunk as a promise (memoization is rather difficult to implement in Erlang, which means that, for example, SICP implicit stream definition of the Fibonacci sequence is rather inefficient).</div><div><br></div><div>On the other hand, Erlang controls much better the heap with the sieve than gsi and asking for the 100 000th prime number is just a matter of time. Gambit gsi heap grows so fast that the algorithm is just useful for teaching.</div><div><br></div><div>I wondered if this difference was related to the delay/force implementation and to the place of the call to cdr (that is delayed or not). I rewrote the streams algorithms in scheme so they were as closed as possible to Erlang.</div><div><br></div><div>On gsi, this has not lead to any improvement. Setting a maximum heap size has only resulted in raising an exception.</div><div>On Scheme48, the sieve runs like in Erlang though slower. Erlang alike algorithms are nevertheless much much faster (about three times for the sieve).</div><div><br></div><div>I believe Scheme48 and Erlang use the same kind of garbage collector... So is there a way to better to tune Gambit garbage collector or is this a garbage collector algorithm problem? </div><div><br></div><div>Thanks,</div><div><br></div><div>Denis</div><div>Ps <a href="http://mitpress.mit.edu/sicp/full-text/book/book.html" target="_blank" style="font-size: 12pt;">http://mitpress.mit.edu/sicp/full-text/book/book.html</a></div><div><br></div><div><br></div><div><br></div>                                     </div></body>
</html>