|
From: Csaba H. <csa...@cr...> - 2007-04-17 14:29:51
|
On 2007-04-16, Chris Double <chr...@do...> wrote: > If all you want to test is coroutines, rather than the message passing > aspects of concurrency, you can use libs/coroutines: > > "libs/coroutines" require > USE: coroutines >: gen ( -- co ) [ 100000 [ over coyield 2drop ] each f swap coyield ] cocreate ; >: run ( co -- ) f swap coresume [ run ] [ drop ] if ; > > [ gen run ] time > > This is the equivalent of the Python sample you posted. Unfortunately > continuations don't compile so the test runs interpreted. Ah, thanks, superb. I did look into the coroutines module but apparently I was somewhat absent-minded as I looked over the co* words. The benchmark result is not in the top category but I think it's still not bad given that continuations are implemented in the language itself (and, as you say, they run interpreted). python: 0.02 s gambit scheme (interpreted): 0.25 s python with greenlets based generators: 0.45 s factor: 0.73 s ruby: 1.35 s Csaba |