lua-users home
lua-l archive

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

>It's not the performance of creating the tables that I'm worried about,
>but rather all the accesses to the table contents.

Tables are the central data structure in Lua.
You shouldn't have to worry about table performance.
A lot of effort is spent trying to make tables fast.
For instance, there is a special opcode for a.x.
See the difference between a.x and a[x]:

      1  [1]     GETGLOBAL       0       ; a
      2  [1]     GETDOTTED       1       ; x             -- a.x
      3  [1]     GETGLOBAL       0       ; a
      4  [1]     GETGLOBAL       1       ; x
      5  [1]     GETTABLE                                -- a[x]
      6  [1]     RETURN          0
      7  [1]     END

but, like you said, the difference here is essentially an extra GETGLOBAL.