[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Fastest way to transfer data from C to Lua ?
- From: Coda Highland <chighland@...>
- Date: Thu, 6 Jun 2013 15:38:26 -0700
On Thu, Jun 6, 2013 at 3:36 PM, Tim Hill <drtimhill@gmail.com> 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.
>
> --Tim
Alternatively, one array of 2000 elements, interleaved odd/even, which
could potentially have performance benefits beyond just memory
consumption. (Could. Not guaranteed. Profile, profile, profile.)
/s/ Adam