[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: On lua5 and embedding
- From: "Thomas Wrensch" <twrensch@...>
- Date: Wed, 29 Jan 2003 15:22:51 -0800
>>> firstname.lastname@example.org 01/29/03 11:00 AM >>>
>>I modified the timing code to use x:fact(10) and the
>>time was slightly FASTER at 8.44 seconds.
> Probably because now you're indexing a local variable
> local function fact(n)
> in the original code...
Actually, I think there's more to it. While 'self' is a local variable,
it is a table itself, and 'fact' is looked up in that table.
Moreover, the 'self' table is an empty table. Each lookup of 'fact'
lookup 'fact' in 'self' which fails
check for a metatable, which exists
lookup __index in the metatable
since __index is a table, lookup 'fact' there
I assumed the small increase in speed was due to the size of the tables
involved. Or am I missing something?