[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Performance of key lookups
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 25 Jun 2001 20:50:45 -0300
>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  GETGLOBAL 0 ; a
2  GETDOTTED 1 ; x -- a.x
3  GETGLOBAL 0 ; a
4  GETGLOBAL 1 ; x
5  GETTABLE -- a[x]
6  RETURN 0
7  END
but, like you said, the difference here is essentially an extra GETGLOBAL.