Lua In Real Time Programs

lua-users home

VersionNotice: This article relates to an earlier version of Lua. Incremental garbage collection is available as of Lua 5.1.

Older versions of Lua (prior to 5.1) are not well-suited for the main loops of real-time programs. The reason isn't that Lua is slow--in fact it probably has the fastest virtual machine of any scripting language. The problem is the mark-and-sweep garbage collection (GC), which requires a concentrated chunk of CPU time proportional to the number of objects allocated. It was useful in 5.1 to replace the mark-and-sweep collector with a real-time incremental system (see paper Real-Time Non-Copying Garbage Collection [1]). In older version of Lua, there are still several ways to make good use of Lua in real-time programs:

See also: OptimisationTips, GarbageCollection/GarbageCollectionInRealTimeGames, ProfilingLuaCode
RecentChanges · preferences
edit · history
Last edited October 25, 2008 3:53 pm GMT (diff)