Without resorting to static analysis, wouldn't a combination of a stack-as-nursery (e.g. in the style of Gambit Scheme) and one-bit reference counting (does any implementation use that these days?) help a lot with the performance of mixing delimited control with more linear control flows?
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org A student who changes the course of history is probably taking an exam. On Sun, Dec 1, 2019 at 10:30 AM Matthias Felleisen <[email protected]> wrote: > > > > On Dec 1, 2019, at 9:47 AM, Matthew Flatt <[email protected]> wrote: > > 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. > > > > The speed of continuation operations in SML/NJ (and probably Pycket) > is, in my mind, vastly overrated. It neglects the entire calculation of > heap allocation, gc, and other global effects on time that just aren’t > measured. > > > > 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. > > > > A true comparison would start with a complete reimplementation of > SML using “stacks" and Hieb et al.’s "lazy continuations”. That way > you’d get the type information, static analysis, and indefinite recursion. > > (I do wonder now whether MLton has call/cc and friends. It’s the > closest I can think of.) > > ;; - - - > > Having said that, I still do wonder whether call/cc per se is needed (see > note cited by Alexis) and whether we wouldn’t be better off thinking thru > F, Dorai’s #, and a dynamic-wind appropriate for that setting. Even in our > famous examples (web browser, time pre-emption) I have yet to see an > undelimited use of continuations. > > Mach 3 (Draves, CMU and Microsoft) demonstrated that OSes definitely > get all of what they need from delimited continuations. (Indeed, they > initially thought that they invented delimited continuations but I had > imagined > them myself in Dan’s 1984 “511” implementing numerous small kernel > “thingies.”) > > > — Matthias > > > > [1] > https://www.microsoft.com/en-us/research/publication/control-transfer-in-operating-system-kernels/ > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/racket-dev/348CBCC5-9C49-4186-99B4-FE13A79FACC6%40felleisen.org. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/CAN7nBXeT7vbZMrKH%3Dd6ovxNQGYZfYMgPOCZd5HbD3NxjwQvfQA%40mail.gmail.com.
