tevent: optimize adding new timer events
authorStefan Metzmacher <metze@samba.org>
Fri, 22 Feb 2013 11:45:39 +0000 (12:45 +0100)
committerAmitay Isaacs <amitay@gmail.com>
Wed, 6 Mar 2013 06:43:20 +0000 (17:43 +1100)
commit28602eeb613030c49d32156f57614c059b136105
tree730b57f22aa481c018508387f0ee9851ad9695ff
parent8909931f7dd067e5319a0db15fcb6cb0c335f903
tevent: optimize adding new timer events

There're two cases:

1. Adding a timer with a zero timestamp.
   Such events were used before we had immediate events.
   It's likely that there're a lot of this events
   and we need to add new ones in fifo order.

2. Adding a timer with a real timestamp.
   As this timestamps typically get higher:-)
   it's better to traverse the existing list from
   the tail.

This is not completely optimal, but it should be better
than before.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
lib/tevent/tevent.c
lib/tevent/tevent_internal.h
lib/tevent/tevent_timed.c