lua-users home
lua-l archive

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

On Tue, Sep 14, 2004 at 07:43:17PM +0300, Asko Kauppi wrote:

> On dedicated lists, my first reaction was "why"?  This may be an issue 
> where you have to delearn something. Personally, I couldn't come up 
> with a single case where I'd needed lists with Lua.  And even if I did, 
> a case where the runtime cost would have called for optimization.

But you use tables as lists.  This isn't really a discussion of basic
datatypes, as Lua has taken the everything-from-table approach, but
entirely a question of optimization.  I agree with the original poster
that the hacks to make lists efficient seem inelegant and are costly.
table.insert and table.remove use a whole function call for simple and
common tasks.

I've been in situations where the optimization is crucial, and I've had
to go to C code to make it fast enough.

> If you have a good case, could you share that with us?  Something, 
> where having a dedicated list object would really boost the performance 
> of the application?  

Tight loops in numeric codes tend to be good candidates here.


Shannon Stewman         | Let us walk through the waning night,
Caught in a whirlpool,  | As dawn-rays tickle our toes, the dew soothes
A quartering act:       | Our blistered soles, and damp bones stir
Solitude or society?    | As crimson cracks under the blue-grey sky.