[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: void* in Lua_State for Application?
- From: Tom N Harris <telliamed@...>
- Date: Thu, 05 Sep 2013 14:43:28 -0400
On Wednesday, September 04, 2013 08:42:48 PM Coda Highland wrote:
> Performance, mostly. That's a table lookup worth of overhead for every
> function that needs to fetch it. A C function accessing a field in the
> lua_State is substantially faster.
So it's just the classic speed-vs-space tradeoff. Either waste time doing a
table lookup for the people who need it, or waste a pointer-sized field in
lua_State for the people who don't need it.
LUAI_EXTRASPACE is kind of a nice compromise since the it costs nothing if you
don't use it. At the cost of having to recompile. But that may be necessary
anyway in uses where the registry isn't an option. For example, to store a
per-state mutex.
--
tom <telliamed@whoopdedo.org>