lua-users home
lua-l archive

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


On 04/21/2014 05:07 AM, katlogic@katsystems.eu wrote:
On Sun, Apr 20, 2014 at 02:55:38PM +0200, Dirk Laurie wrote:
2014-04-20 13:50 GMT+02:00 Peng Zhicheng <pengzhicheng1986@gmail.com>:

I feel it too much overhead using the full userdata just to pass some opaque
values, and I need to set a per-instance metatable everytime I produced that
value.
Given that you will have a metatable per instance, please explain (more
concisely than the original post please) just how much overhead relative
to a full userdata you think you are saving.
While Peng didn't articulate it exactly well in english, the code is
self-explanatory. Metatables are stored once, globally, per tag
"extension" type. Instances are then only tagged accordingly.

I'm using something similiar since Lua 5.1, and a lot of game folk would
welcome official support for this, as it is now, most of us are stuck with
personal kludges.

GC pressure is most common Lua bottleneck, and this is one of the viable
ways to solve it (alternative is to use "ID" API which is more demanding
both on C side, and Lua environment user, but supposedly "cleaner").


thanks for pointing out that.

I am not a game developer. I don't have much experience of the GC presure problem.
although I was not aiming at decreasing the GC loads in the first place, I am very
glad to know it is one of the viable ways for that.


btw, could you please explain more about your proposol of "ID" API? I can't think up
a proper Lua side API or syntax for such situations.