[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: cooperative multitasking
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 07 Jun 2002 17:49:07 -0300
> In Stackless Python, switching to a coroutine is much faster than a
> function call, since the frame is already allocated and set up. I had
> hoped this was true in Lua also.
You must remember that function calls in Lua are much faster than in
Python, and so it is easier for coroutines in Python to be faster than
function calls ;-).
In a quick-and-dirty "benchmark" it seems that coroutine switching in
Lua is as fast as function calls, except that coroutines do not return
straight, but need an "extra" call (to yield) to "return".