[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua in high performance apps
- From: "Joshua Jensen" <jjensen@...>
- Date: Mon, 16 Apr 2001 23:40:20 -0600
From: "John Belmonte" <firstname.lastname@example.org>
Sent: Monday, April 16, 2001 10:07 PM
> Joshua Jensen wrote:
> > I've used Lua in real-time apps (read: games) with great success, but
> > if I profile and understand where the bottlenecks in the Lua script are.
> > These are some optimization strategies I use (off the top of my head):
> The term "real time" by itself is not very descriptive, and it probably
> means something different to each of us. What you are addressing is how
> write Lua scripts that execute quickly, and that is certainly important
> know-how. However Lua speed isn't the problem in my case-- I've found it
> sufficiently fast for light use (for example calling a few hundred lines
> code per frame). Independent of execution speed is the issue of time
> collecting garbage, and whether that time is amortized or happens all at
> once. Regardless of how lightly I use Lua or how fast my script is, if a
> cycle comes and causes a missed frame it's "game over".
I absolutely agree on the garbage collection issue.
> Unfortunately the weight of the gc cycle is not necessarily related to how
> much Lua code I'm executing. For example if I've got a Lua library 10,000
> lines in length with plenty of internal state, even if I'm only executing
> 100 lines of that library code per frame and being careful not to generate
> much garbage, eventually that gc cycle will come (given an embedded system
> with limited memory) and will have to scan all the objects in the Lua
I don't remember the recent garbage collection threads, but I'll be sure to
read them. In my high-speed loops, I try to ensure the same thing in Lua
that I do in C... that no allocations/deallocations are performed unless
absolutely necessary. So I've never really run into a problem with the GC,
but it is of concern now to me based on your comments.
Author, Workspace Whiz! - A Visual Studio Add-in