[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Question about accessing Lua tables and arrays faster
- From: Jay Carlson <nop@...>
- Date: Thu, 25 Jul 2013 18:11:41 -0400
On Jul 25, 2013, at 11:00 AM, Leo Romanoff wrote:
> Questions about arrays:
> - Would it make sense to have an additional dedicated type for arrays as it is usually the case in most programming languages? Would it make things any faster, e.g. because it could use a more efficient internal representation? Or would it still be rather slow, because the problem is not the internal representation of arrays but Lua VM itself?
For arrays of general Lua values, I don't see how you can do better than the table implementation, except maybe by pre-sizing the array part. For arrays of uniform scalar types, this is exercise 29.3 in _Programming in Lua_.