Pycket has the fastest implementation of delimited control that I know.
Pycket's continuations are fast because it uses heap-based continuation
frames. SML/NJ continuations are fast for the same reason. And Pycket
gets all of Racket's control operators, because it directly implements
the ICFP'07 model.
As long as your program is just manipulating continuations, then
heap-based frames are the way to go. But if your programs spends a lot
of time in more conventional control patterns, then further work is
needed to make heap-based frames perform well overall. Pycket relies on
a tracing JIT to make its heap-based on model run fast overall, while
SML/NJ relies on compile-time analysis.
For an implementation that relies on a representation choice instead of
tracing or analysis, Racket CS's implementation of delimited control is
the state of the art --- mostly by building on Chez Scheme's
implementation of continuations.
For details, you'll want to go back to
"Representing Control in the Presence of First-Class Continuations"
Hieb, Dybvig, and Bruggeman (PLDI 1990)
The Rumble layer on top of that for delimiting uses metacontinuations.
It's probably about the same as implementations in
"Final Shift for call/cc: a Direct Implementation of Shift and Reset"
Gasbichler and Sperber (ICFP 2002)
but I haven't yet gone back to check or to see how that compares to the
approach in "A Mondaic Framework ...". Rumble's tail correction to
metacontinuations is probably essentially the same as in "A Mondaic
Framework ...". In any case, see "racket/src/cs/rumble/control.ss".
The Racket CS implementation of continuation marks benefits from direct
support in Chez Scheme for "continuation attachments". Attachments are
like marks, but with just one implicit key, so a key+value layer is
implemented in Racket CS by installing a dictionary as the single
attachment value. The implementation of attachments in Chez Scheme
exploits the representation of continuations to make mark operations
inexpensive. I'll send you more details separately.
For a monadic implementation, "A Mondaic Framework ..." is
state-of-the-art as far as I know. See also Oleg's variant
(
http://okmij.org/ftp/continuations/implementations.html). I don't know
what it would meant to implement delimited control more primitively in
a lazy language.
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
racket-dev+...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/racket-dev/7559EBB2-4B34-49D1-921A-21C0D93B3E
> BE%
40gmail.com.