lua-users home
lua-l archive

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


My patch is somewhat tangential to this - all it does is copy a table reference from the type metatable slot in the State to the value metatable slot in the object whenever a new table or userdata is created. So the performance overhead is negligible. 

Specifically for functions only, I wonder if something cleaver could be done with upvalues? Some way of having a table referenced in an upvalue be taken as the metatable. This could give per-value metatables with similar performance overhead to the current per-type ones. With some automatic management like is currently done for environments, this could give a very flexible mechanism.

> Date: Tue, 19 Nov 2013 14:40:12 +0200
> From: steve donovan <steve.j.donovan@gmail.com>
> Subject: Re: Operators on functions

> > but I fear that it is not easy to do without sacrificing overall Lua
> > performance or code size (I'd like to be proven wrong, though).
> 
> That is absolutely the question I'd like to see answered - if John
> could give us some numbers based on his patch, for instance.