lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Graham Wakefield wrote:
> Does this mean that using large numbers of coroutines (e.g. hundreds 
> concurrently, or hundreds of thousands over a program's lifetime) may be 
> more expensive in luajit 1.x than plain lua?

Yes, unfortunately. At least if you need all of them to be alive
at the same time. Try to recycle coroutines instead of creating
and collecting them repeatedly.

The minimum amount of memory for a coroutine in LuaJIT 1.x is ~37K
(and much more on Windows due to limitations of Windows Fibers).

> And if so, is this also 
> likely to be the case in the eagerly anticipated luajit 2.0?

No. The minimum amount of memory for a coroutine in LuaJIT 2.x
will be ~450 bytes (thread object plus minimum Lua stack).

[Plain Lua compiled with lua_Number as a double needs ~850 bytes
(Linux/BSD/OSX x86) or ~1050 bytes (Win32 and all other platforms).]

--Mike