Niels,
I found out why. 1.4.9 has a tv_cache in gettime():
static int
gettime(struct event_base *base, struct timeval *tp){
if (base->tv_cache.tv_sec) {
*tp = base->tv_cache;
return (0);
}
....(omitted)...
}
We happened to use timer as our message pump (my original statement about using
timer as timeout management wasn't quite right after I read the code) to
process some UDP packets. But then, this cached timestamp can be 1 to 3ms out
of date in our code. So the whole pumping was slowed down 2x. I confirmed this
by dumping all timeout_process()'s timestamps when an event is detected as
"timed-out", and all of them were shifted or lagged behind than the ones
collected with 1.3c build.
Anyways, I'll have to re-think our model. At the same time, may I ask why the
change? Was that for calling gettimeofday() less number of times to be more
efficient? But the code only updates base->tv_cache once per loop, each of
which may take several milliseconds to finish. Doesn't that leave huge space
for an inaccurate timestamp?
-Haiping
On 4/14/09 4:59 PM, "Niels Provos" <[email protected]> wrote:
On Tue, Apr 14, 2009 at 3:37 PM, Haiping Zhao <[email protected]> wrote:
> We have a piece of code that was using 1.3c, and when I switched it to use
> 1.4.9-stable, I found it's 2x slower, spending almost all extra time in I/O
> waiting. This piece of code does simple UDP handling, and we do have timers
> going on for timeout management.
I am not aware of anything that would have made libevent slower
between 1.3 and 1.4. It should be slightly faster actually.
What do you mean by I/O waiting? Your code is blocking on IO?
Niels.
_______________________________________________
Libevent-users mailing list
[email protected]
http://monkeymail.org/mailman/listinfo/libevent-users