Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So you speculate despite not knowing either language or use case? Nevertheless I don't want to be a bad geek so I did some trivial googling:

http://stackoverflow.com/questions/4064451/luas-gc-and-realt...

tldr; LUA's GC isn't magic and for games you need to control it carefully. Even then a reference counting system is often better.

Answer excerpted:

As for the garbage collector. Use it as is first. If later you find performance issues use lua_gc to fine tune its behavior.

Some examples:

Disable the garbage collector during those times when the slow down would be a problem.

Leave the garbage collector disabled and only step it when game logic says you've got some head room on your FPS count. You could pre-tune the step size, or discover the optimal step size at runtime.

Disable the collector and perform full collection at stopping points, ie a load screen or cut scene or at turn change in a hot seat game.

You might also consider an alternative scripting language. Squirrel tries very hard to be a second generation Lua. It tries to keep all of Lua's good features, while ditching any of its design mistakes. One of the big differences between the two is squirrel uses reference counting instead of garbage collection. It turns out that reference counting can be a bit slower than garbage collection but it is very deterministic(AKA realtime).



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: