lua-users home
lua-l archive

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


Dylan Cuthbert wrote:

Also I do avoid creating tables (avoid, but not completly disallow)
during normal operation, I have been able to keep my garbage generation
relatively modest so far.


It seems like you're trying to fight a tsunami with a feather as the
complexity and number of your tasks increase though.  The problem is, unless
the garbage collector is very smart its going to have to go through pretty
much every single object in existance checking its reference count, when a
few quick checks after an expression would solve the problem.  Going through
every object at the end of every frame seems to be a major amount of
overhead.  Of course, the garbage collector might not be as naive as this, I
haven't analysed that part of Lua yet.


This of course depends among other things on the division between
Lua and the C++ (in my case) world. I admit that most of my data
is in the C++ side. On Lua side I only have couple of tables for
each "intelligent" object for my world.

As it is, I am doing so much computation in Lua that the interpreter
speed is an issue. Surprisingly the GC is not significantly visible
in my profiling results (Vtune & AMD Codeanalyst). My worst
CPU spikes happen in Lua internal table search (apparently VC++
manages to create code which doesn't suite my processor well), and
in the lua virtual machine code, which really breaks branch
prediction.

It still seems that I am lucky enough, that I can implement my
project to the end with current Lua GC behaviour if needed, even
if I force full GC 50-75 times per second.

			Eero