lua-users home
lua-l archive

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


lua coroutine is very lean on memory but with coco patch, it needs much more memory(which I believe is related to using the C-stack instead of heap).


--- On Sat, 4/25/09, Phoenix Sol <phoenix@burninglabs.com> wrote:

> From: Phoenix Sol <phoenix@burninglabs.com>
> Subject: Re: [Stackless] lua vs. stackless python
> To: "Lua list" <lua@bazar2.conectiva.com.br>, "stackless@stackless.com" <stackless@stackless.com>
> Date: Saturday, April 25, 2009, 12:12 AM
> Very nice, thanks Peter!
> 
> On Fri, Apr 24, 2009 at 9:08 AM,
> Peter Cawley <lua@corsix.org>
> wrote:
> 
> A coroutine appears to cost around a kilobyte (20695 -
> 19601 = 1094 bytes):
> 
> 
> 
> collectgarbage"collect"
> 
> print(collectgarbage"count" * 1024) --> 19559
> 
> local function F()
> 
> end
> 
> print(collectgarbage"count" * 1024) --> 19601
> 
> local C = coroutine.wrap(F)
> 
> print(collectgarbage"count" * 1024) --> 20695
> 
> 
> 
> Test done on Win32/Vista, self-compiled Lua (using Visual
> Studio
> 
> 2008), source code executed all-at-once from a file rather
> than from
> 
> an interactive terminal.
> 
> 
> 
> On Fri, Apr 24, 2009 at 4:52 PM, Phoenix Sol <phoenix@burninglabs.com>
> wrote:
> 
> > And is there a known overhead for a lua coro? (Maybe
> it would be more fair
> 
> > to compare a tasklet to a 'Coco' coroutine...
> but still I wonder what the
> 
> > overhead of wrapping a function with coroutine.wrap()
> is...)
> 
> >
> 
> 
> 
>