lua-users home
lua-l archive

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


----- Original Message -----
> To try to improve garbage collection in Lua, we need data about it in
> real programs. So, if you think you can have problems with it, please
> consider taking some time to tell us about your problems. If you prefer,
> send the data directly to us [lua at tecgraf...]; we will keep it
> confidential. We cannot promise anything, but such data will certainly
> increase the chances.

Let me start with one of my projects.

Crazy Ivan is autonomous robot that participates in competitions. We use Lua
because we need a tool where we can change everything right in the pit
without having to compile/download/flash etc.etc.... And we need advanced
data structures to handle our data.

The main structure of the software is a loop.

repeat
    Collect Data From Sensors
    Store And Calculate
    Change Motor Speeds
until I win

This is run on a machine with a Motorla Coldfire 5206e (50 Mips) - a CPU
without MMU.  The loop should run somewhere 80-100 times/second, but lot of
the time was used by the collect data bus.

What we would see from time to time was the robot running off the curse
because a GC cycle used ~ 200 - 500 ms, and ofcause this would not take
place when the wheel where pointing forward :-) Our solution is a forced GC
cycle with the motors stopped for every 1000 (main loop) cycles - not very
nice but quite effective.

In the collection state we would keep tables with the last 10-100 samples
from every sensor and doing calculations on those.

Another dimension in this is the present of static objects. When we where
running all functions and a lot of global variables would not be touched -
So some sort of "disregards from GC" scope could be very interesting,
something like:

F = 34
enterrealtime()
x={}
repeat
  x[Mycounter] = DataFromSensors()
until finish
exitrealtime()

would ever spend time considering F and all functions - but a mark and sweep
GC should do this, right?

/Erik

p.s. We are building a new robot where the GC cycle take place while some
other housekeeping (Download from camera in C) are running.