[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Metatable check helper API proposal
- From: Sergey Zakharchenko <doublef.mobile@...>
- Date: Wed, 19 Aug 2020 09:50:03 +0400
Hello,
This is a continuation of my luaL_checkudata/luaL_testudata
optimization ideas. How about a new API, lua_metatabletopointer (or
lua_getmetatablepointer?), acting as if lua_getmetatable followed by
lua_topointer, but without touching the Lua stack? This would enable
faster "are we really called with 'our' userdata?" checks and reduce
userdata metamethod call overhead (checks would trivially extend to,
say, a list of metatables known to a function).
There's a small implementation of it inside lua_getmetatable already:)
Best regards,
--
DoubleF