[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Tons of reallocs in Lua - why?
- From: "Michael Surette" <mjsurette@...>
- Date: Fri, 22 Dec 2006 09:11:10 -0500
On 12/22/06, Ivko Stanilov <email@example.com> wrote:
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 can specify an initial size in the lua_createtable C API function. Perhaps a custom C function calling this for new tables would be a quick and easy solution.