On Mon, Jun 11, 2007, Matthieu PATOU wrote:
> Dear list,
> 
> i'm working on a partial C implementation of the memcache PERL client.
> The part i rewrote in C was a big loop around a select that handled read 
> and write from the various memcached server.
> 
> I was expecting the libevent code to be quicker or least not slower than a 
> standard select call.
> With linux, this assumption seems true, but under Freebsd it seems false.
> 
> Tracing the syscall with strace shows that clock_gettime is called on 
> average 3 times between a read or write event.

Its known that FreeBSD's gettimeofday() call isn't going to be as fast
as the Linux version (doesn't the Linux version do some hackery to stay
in userspace?) but its occuring during every event_add() for what I can
only assume is a second-resolution timeout timer.

I'm not uptodate on the libevent internals - perhaps someone else could
take a look at how feasable it'd be to store a copy of the gettimeofday()
results at the beginning of each trip through the event loop (per thread!)
and use that value for ev_add().

(Squid does this to get around the slowness of doing massive amounts of
gettimeofday() calls for this precise reason.)

2c,




Adrian

_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to