[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Tons of reallocs in Lua - why?
- From: roberto@... (Roberto Ierusalimschy)
- Date: Fri, 22 Dec 2006 15:11:20 -0200
> I think you could add a mininum table allocation size (or minumum
> allocated entries at table creation) macro in 'luaconf.h'. Because
> we're not limited by memory constraints, we'd happily set this
> value to 8 or 16 if it existed, so we can save time from
> reallocations. But I'm not so sure about this, since I guess we could
> just optimize our code ;)
You may want to try the _very_dirty_hack_ of creating your tables like
this:
t = {nil,nil,nil,nil,nil,nil,nil,nil,nil,nil}
In this way, the table is created with eight (empty) slots.
-- Roberto