http://www.perlmonks.org?node_id=169614

vaevictus has asked for the wisdom of the Perl Monks concerning the following question:

I'm working on a game, and I need to give it a time based event queue. I'm concerned about efficiency, to an extent.

Here are my problems:

Array of Arrays seems inefficient when the nodes are very far apart, requiring lots of iteration, and i'm not so sure how it would scale when i've inserted and removed millions of events.

Hashes of Arrays seems better about most things, but requires a expensive sort every pop(), or possibly a sort upon each new timestamp needed, if you store the "lowest" somewhere.

I'm sure TMTOWTDI.
Any modules out there that might help out?
Or, any suggestions on how to do this efficiently?