tevent: optimize adding new timer events
authorStefan Metzmacher <metze@samba.org>
Fri, 22 Feb 2013 11:45:39 +0000 (12:45 +0100)
committerKarolin Seeger <kseeger@samba.org>
Wed, 6 Mar 2013 09:12:02 +0000 (10:12 +0100)
commit877545860cc97ba3cce9a9d59a15a1dba24aecac
tree601cf787a5f2efd0897a7f880fc7ab60f31970fe
parent88a4927a6cb28ae792e30900ba6f6b5200763dd5
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>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/tevent/tevent_timed.c