|
Roberto Ierusalimschy wrote:
I have about 130 000 userdata objects. The reason for that insane ammout is that I am simulating a big world and many of the C/C++ objects are mirrored on the Lua side as userdata.Do all these objects have a metatable and/or a __gc metamethod? We were considering whether it would be worth some optimization to avoid traversing objects without a metatable/__gc metamethod in function luaC_separateudata, but that would be useful only for programs that create lots of userdata without finalizers...
They all have metatables. There are about 100 000 without finalizers (they are strictly mathematical objects whose lifetime is fully controlled by lua), and 30 000 with finalizers (to synchronize C++ lifetime and lua lifetime).
// Niklas