lua-users home
lua-l archive

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


On Thursday 15 April 2004 7:55 pm, Adam D. Moss wrote:
> >    Avoid  using  Lua  in  "every  frame"  actions  as  performance  drops
> >    dramatically.  For example, don't use Lua to do animation updates; set
> >    up  parameters  for  the  animation in Lua and do the updates in C/C++
> >    code.
>
> Yes!!  I wish I'd had someone warn me six months ago.  :)  I'm
> still not sure why Lua seems to perform very respectably for
> reactive tasks and even a lot of general-purpose crunching but
> REALLY starts to drag when doing even a few rather simple
> tasks /every/ frame.  Perhaps the setup of invoking Lua from C
> is fairly heavy (I suspect not) or it's a more subtle issue
> such as Lua thrashing the memory caches.

Our last game (http://www.lua.org/uses.html#113) was writtern using renderware 
as a base witht he whole game being writtern in Lua. All iteration and 
processing was done from a Lua main function.

We found that the garbage collector would cause the game to pause every so 
often, so we called it every frame, that slowed us down quite a bit. I think 
that was due to more to lazy coding rather than a problem with Lua itself.

While the games were quite simple, we literally did everything in Lua, 
including vector and maths calculations.

The target machine was a P3 400Mhz PC

Rob