[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Fastest way to transfer data from C to Lua ?
- From: David Heiko Kolf <david@...>
- Date: Fri, 07 Jun 2013 18:10:13 +0200
Tim Hill wrote:
> One thing to be aware of if you are running on a *really* resource
> constrained system is that you are better off with fewer, bigger,
> tables. Consider storing 1000 (x,y) pairs. The obvious way to do this is
> to store 1000 {x,y} tables in an array. However, although it's not as
> elegant, you are better off storing this as two simple arrays of 1000
> elements, one containing the x values, one the y. This second method
> uses only two tables instead of 1,001.
>
> And yes, the code is FAR less readable. Also, of course, if you do use
> this method, the whole keys vs indices argument goes away.
Storing it in a few big arrays would also be my suggestion and I guess
it could also be quite readable:
myTime = mySamples.time[434]
myValue = mySamples.value[434]
Best regards,
David Kolf