[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- 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 [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.
--lhf