Disable lazy gettimeofday/clock_gettime comparison

The benefit of this optimization is questionable for the following
reasons:
- libevent uses CLOCK_MONOTONIC_COARSE which is fast enough (on my
  desktop CLOCK_MONOTONIC/CLOCK_MONOTONIC_RAW works 40/50 millions of
  ops per second, and CLOCK_MONOTONIC_COARSE is faster)
- libevent has caching of time (EVENT_BASE_FLAG_NO_CACHE_TIME)

So I don't see any reason for using one more caching - lazy comparsion
(whatever you call it).
This commit is contained in:
Azat Khuzhin 2023-06-20 22:18:41 +02:00
parent 13366d2711
commit 2e31277207

View File

@ -409,7 +409,7 @@ static void event_debug_assert_socket_nonblocking_(evutil_socket_t fd) { (void)f
/* How often (in seconds) do we check for changes in wall clock time relative
* to monotonic time? Set this to -1 for 'never.' */
#define CLOCK_SYNC_INTERVAL 5
#define CLOCK_SYNC_INTERVAL -1
/** Set 'tp' to the current time according to 'base'. We must hold the lock
* on 'base'. If there is a cached time, return it. Otherwise, use
@ -2770,7 +2770,6 @@ event_add_nolock_(struct event *ev, const struct timeval *tv,
event_queue_remove_active(base, event_to_event_callback(ev));
}
base->last_updated_clock_diff = 0; // force diff recalc for correct ev->ev_timeout calculation
gettime(base, &now);
common_timeout = is_common_timeout(tv, base);