[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: Eli Barzilay <eli@xxxxxxxxxxxx>*Subject*: Re: simpler srfi 45 implementation*From*: AndrevanTonder <andre@xxxxxxxxxxxxx>*Date*: Tue, 13 Nov 2007 10:54:43 -0500 (EST)*Cc*: Jos Koot <jos.koot@xxxxxxxxxxxxxx>, Phil Bewig <pbewig@xxxxxxxxx>, srfi-45@xxxxxxxxxxxxxxxxx*Delivered-to*: srfi-45@xxxxxxxxxxxxxxxxx*In-reply-to*: <18233.39965.878836.78458@xxxxxxxxxxxxxxxxxxxxxx>*References*: <001001c825de$11b10380$2101a8c0@jos> <18233.39965.878836.78458@xxxxxxxxxxxxxxxxxxxxxx>

On Tue, 13 Nov 2007, Eli Barzilay wrote:

I was aware of the possible optimization at the time, but didn't find any example where it mattered. However, if you do put it in:[(promise? p) (let* ((v (force p))) (if (not (pair? (promise-p prom))) (set-promise-p! prom (list v))) (car (promise-p prom)))]then you do the recursive forcing of `p' in a non-tail conext. My (vague, not formal at all) feeling about these "referral promises" is that they do happen in places where the original code had a tail call, so it might be a bad idea to break it.

The suggested optimization looks very suspicious also to me. It seems that the non-tail-call could break space-safety. Two questions: - Have you run the SRFI-45 tests on your suggested optimization? Note that this involves uncommenting the mostly nonterminating test cases, letting them run for some time, keeping track of the memory consumption with some other tool, and verifying that it stays bounded. Of course, this is not a substitute for a theoretical analysis, but it should show pretty quickly if you are not on the right track. - Did you find the same slowdown for the first implementation given in the message http://srfi.schemers.org/srfi-45/post-mail-archive/msg00010.html ? (That one is easier for me to understand and comment on - Eli's I would have to study again). Cheers Andre

**Follow-Ups**:**Re: simpler srfi 45 implementation***From:*Jos Koot

**References**:**Re: simpler srfi 45 implementation***From:*Eli Barzilay

- Prev by Date:
**Re: simpler srfi 45 implementation** - Next by Date:
**simpler srfi 45 implementation** - Previous by thread:
**Re: simpler srfi 45 implementation** - Next by thread:
**Re: simpler srfi 45 implementation** - Index(es):