lua-users home
lua-l archive

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

Geoff Leyland wrote:
Good question. I just tested (b) vs a pure lua binary heap and the binary heap is so much better (the sort version still hasn't finished) that I think I must have got (b) wrong (does table.qsort exist? I can only find table.sort documented. Which is better out of table_insert(t, x) and t[#t+1] = x?)

If you want to try my heap code I can send it, but I think there's one in loop that's bound to be better.

That deeply surprises me, but I can hardly argue with results --- so, yes please, I'd love a copy.

(For context: it's to handle a message queue. The priorities are timestamps and will be floats. Therefore bundling up equal priorities isn't going to be any use, although it might be worth special-casing the 'now' timestamp.)

I've looked at loop. Unfortunately, loop uses lots of infrastructure I don't want to use, and is also very focused on the Javascripty data-and-methods-in-the-same-namespace model which makes me rather uneasy (although priority queues are one exception), so I'd rather have my own version where I know what it does.

Thanks for all the comments, people!

David Given