lua-users home
lua-l archive

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


On Mon, Sep 11, 2006 at 01:03:46PM -0500, Tim Gogolin wrote:
> Right; I understand this point of view.  The problem though is that  
> table.insert(t, v ) has a hash lookup penalty and a function call  
> penalty.
> 
> local table_insert = table.insert
> 
> will get rid of the hash lookup, but the function call is somewhat  
> painful inside a tight loop.
> 
> I've actually found myself making local tables named "t" (where  
> otherwise I had more meaningful names), in order to make the append  
> easier to read... which is unfortunate.

Would it be possible to add the "table" table as the default metatable
for all tables, as is done for string (I think)? So,

	fu = {}

	fu.insert(5)

Wouldn't necessarily make it faster, but is more readable, IMO, than

    fu = {}

	table.insert(fu, 5)

Sam