[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: continuation efficiency
From: |
Martin Grabmueller |
Subject: |
Re: continuation efficiency |
Date: |
Fri, 6 Jul 2001 10:20:43 +0200 (MET DST) |
> From: address@hidden (Thomas Bushnell, BSG)
> Date: 05 Jul 2001 14:50:28 -0700
>
> I have some potential uses of continuations, which will be used in
> automatically generated code. That makes it easier to go ahead and
> make the continuations all the time, but only use them once in a
> while. (To only make the continuations when they are needed would
> complicate the compiler.) So this question is for those who
> understand guile guts enough to answer sensibly for the particular
> implementations guile uses.
Well, I'm not really an expert on this, but I have by now read the
source code enough to answer the questions. Maybe others can improve
my answers.
> I. Is A substantially worse than B:
>
> A: (call/cc (lambda (c) (do-something)))
> B: (do-something)
>
> (Note that the continuation in A is never used.)
A is worse, because the (machine) stack gets copied, even if the
continuation is not used.
> II. Is A substantially worse than B:
>
> A: (call/cc (lambda (c) (do-some-things) (c do-something)))
> B: (begin (do-some-things) (do-something))
>
> (Note that the escape procedure is only used as a tail call in the
> argument to call/cc.)
Same for this one, the place of the continuation call does not matter,
because the expensive part is the stack copy. (And no clever
optimizations as far as I know.)
> Does the following expression (which runs forever) run forever, or
> does it run out of space? (The astute will notice a connection
> between this question and number I above.)
>
> (letrec
> ((whizzie
> (lambda (argument)
> (argument (call/cc whizzie)))))
> (call/cc whizzie))
Trying this out with my local Guile gives me a stack overflow and so
does not run forever.
Regards,
'martin
- continuation efficiency, Thomas Bushnell, BSG, 2001/07/05
- Re: continuation efficiency,
Martin Grabmueller <=
- Re: continuation efficiency, Marius Vollmer, 2001/07/06
- Re: continuation efficiency, Thomas Bushnell, BSG, 2001/07/06
- Re: continuation efficiency, Martin Grabmueller, 2001/07/07
- Re: continuation efficiency, Thomas Bushnell, BSG, 2001/07/07
- Re: continuation efficiency, Neil Jerram, 2001/07/08
- Re: continuation efficiency, Klaus Schilling, 2001/07/08
- Re: continuation efficiency, Thomas Bushnell, BSG, 2001/07/08
- Re: continuation efficiency, Martin Grabmueller, 2001/07/08
- Re: continuation efficiency, Thomas Bushnell, BSG, 2001/07/08
- Re: continuation efficiency, Marius Vollmer, 2001/07/07