<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div><br></div><div><br>On May 16, 2015, at 5:21 PM, Denis Fourt <<a href="mailto:denis.prog@hotmail.com">denis.prog@hotmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<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>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Gambit-list mailing list</span><br><span><a href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a></span><br><span><a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a></span><br></div></blockquote></body></html>