[MUD-Dev] Event Scheduling

Miroslav Silovic silovic at zesoi.fer.hr
Tue Feb 8 11:33:12 CET 2000

Phillip Lenhardt <philen at funky.monkey.org> writes:

> For those of you who have heavy-use event schedulers, what algorithms are
> you using? I have implemented my event scheduler in Python using a binary
> heap and it can schedule and run somewhere between 100 and 1000 events per
> second without falling more than a second behind on a p2 233 machine
> running openbsd. I was wondering if anyone was getting significantly
> better performance from their scheduler. Examples in Python would be more
> relevant to me, but anything would be appreciated.

While I'm not Python programmer, the main issue with Python is that
its datastructures are not overwritable, meaning you may end up with a
copy of your heap each time you schedule the event (it depends on
other factors, and I haven't used Python enough to be certain of
them). If Python copies the entire heap on each schedule, then you end
up with square complexity even with the heap. To find out of that is
the case, try to add and remove element from the heap 1000 times with
heap lengths of 100 and 1000 - see if the time increases 10 or 100

Otherwise heap is the right data structure for this problem (but the
problem may be with Python, in which case you can only implement the
scheduler outside your Python code and glue it in).

How to eff the ineffable?

MUD-Dev maillist  -  MUD-Dev at kanga.nu

More information about the mud-dev-archive mailing list