lua-users home
lua-l archive

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


Keep in mind also that if you have any bindings to C++ functions/classes
(esp those generated by toLua) you will have additional overhead. We use
multiple Lua states in our codebase. We also autogenerate toLua bindings for
hundreds of classes in our codebase. We soon discovered that each Lua state
was taking up over 500k. This was, of course, unacceptable, and so we messed
around with Lua's guts so that we could have a shared globals and a shared
registry between all Lua states. But if we had designed for one Lua state at
the beginning, perhaps we could have avoided that work.

On the other hand, it's probably still worth the benefits of multiple states
(fault and namespace isolation).

Eric

> -----Original Message-----
> From: owner-lua-l@tecgraf.puc-rio.br
> [mailto:owner-lua-l@tecgraf.puc-rio.br]On Behalf Of Josh Jensen
> Sent: Wednesday, September 19, 2001 11:13 PM
> To: Multiple recipients of list
> Subject: RE: Multiple instances or one global?
>
>
> > > Approximately 20k a state and setup costs...
> >
> > With float numbers and 32-bit VM instruction I'm seeing only
> > 11k per state.
>
> You're right.  My number included the standard libraries.  At that
> point, it is approximately 20k.
>
> Josh