[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua Observations/Questions
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 8 Jul 1999 05:41:45 -0300 (EST)
>From email@example.com Wed Jul 7 21:55:53 1999
>From: Ken Rawlings <firstname.lastname@example.org>
> Thanks, tinsert and tremove are exactly what I was looking for. Looking
> at the documentation, though, i'm a little concerned, given the
> lua equivalent for tinsert. That source implies that tinsert copies
> every object at a given position(after the insert) to that position + 1,
> so that l gets copied to l, making room for something at l.
> Doesn't this make tinsert a O(n) operation, and thus prohibitive for
> dynamic additions to large data sets?
Right. They do shift everything.
However, it's done in C, not in Lua, and so it should be fast enough for
tables with say 1000 elements.
If you're really worried about this *and* have *really* large tables,
consider instead a linked list in Lua.