lua-users home
lua-l archive

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


I am seeing a GC stall of about 8 ms in luaC_separateudata(). After looking at the code and reading chapter 31 of Programming in Lua, I think that there simply are too many userdata objects in my lua state.
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.
I have examined the issue some more and it is not only the mirroring of 
the world that is the problem, it is also that a lot of objects get 
created. Every frame about 300 objects are created which means 36000 
objects in 2 seconds (at 60 Hz).
Most of these objects come from arithmetic operations on vectors (which 
are represented as userdata objects), so my best idea right now is to 
change that to a table representation, which would mean fewer userdata 
objects (possibly at the cost of performance).
// Niklas