lua-users home
lua-l archive

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


Hi Benoit,

I think the extension is a good proposal.

Benoit Germain schrieb:
The current table library isn't convenient to manage FIFOs
efficiently.
But your proposal, incl the FIFO problem, is efficient probably only under special circumstances: rare in/out, small queue.

Basically, you are implementing a FIFO architecture on top of something that isn't made for it. This will, to my understanding, scale badly.

If the API was smoother for the task, it would still leave you with the problem that you are extensively shifting elements around for every access, when what you really want is a linked list with a view on the current head and tail.

Since you don't care for the table keys in a FIFO but the table can't be told to ignore them when doing all the internal shifting, your solution may be to use the keys, not shift the tables at all, i.e. not use remove().

Not sure, also not to contradict your principal request. But it may be a pointer to why remove is not more powerful currently, because it's costly internally.

Henning