tevent: optimize adding new timer events
authorStefan Metzmacher <metze@samba.org>
Fri, 22 Feb 2013 11:45:39 +0000 (12:45 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Mar 2013 17:52:00 +0000 (18:52 +0100)
commitb777605770eb065c7f8efc651b9dadbbe6636c6a
tree3f45cb033d9e11d2087d2662cc2f9405b21b8d8f
parent4356053fc62c6b9a6a2834732fb3f5d6e57cff7c
tevent: optimize adding new timer events

As new 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.

A second optimization could be done for zero timestamps,
we would just remember the last_zero_timer,
but that would change the internal ABI.
Normally thatshould not be a poblem, but the Samba's
source3/lib/events.c abuses tevent_internal.h
from the current source tree, even if an external tevent.h
is used. The other problem is that it makes use of
tevent_common_add_timer() without using
tevent_common_loop_timer_delay().

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