Coro benchmarks ?

Marc Lehmann schmorp at schmorp.de
Mon May 2 10:53:37 CEST 2011


On Mon, May 02, 2011 at 12:17:40AM +0200, Zsbán Ambrus <ambrus at math.bme.hu> wrote:
> That's not the only way in which EV is easier.  EV has a C interface
> (see EV::MakeMaker) so you can manage the integration to the event
> loop directly in C without calling back to perl.  That is, the

True, on the other hand, "easier" is of course a relative thing.

For stuff interfacing other stuff, I typically implementthings based on AE
first and then optionally add EV support though, as not even I can use EV
for every program :)

> Incidentally, when I tried to integrate libcurl with libev, I found
> that if I call the timer callback just when curl asks for it, it does
> not believe that the timeout has been reached already, and asks me to
> wait a little bit more, so the program gets into a busy loop for some
> microseconds.  The only way I found around this is to schedule the
> timer half a millisecond later than curl asks.  Have you seen this
> problem, and if so, how do you handle it in your module?  I haven't

No. libev guarantees that a timer callback will not be invoked "early", but
always "late", however, especially on e.g. Linux, time functions and clocks
are not synchronised. For example, if - were a sequence point, then:

   gettimeofdoay() - time()

can easily be >1, so if a library used e.g. time() then it might see 4
seconds elapsed when gettimeoday would see, say, 5.001s elapsed.

likewise, gettimeofday and CLOCK_MONOTONIC might not be synchronised, and
lastly, gettimeofday and clock_gettime might even disagree to a large
amount, even for the same clock.

libev itself suffers from this problem with e.g. epoll, as unlike select
or poll, epoll (which aparently doesn't even have a single non-misdesigned
part) can return early (and does so often).

The solution for all problems is to add another iteration, or many, and
ignore it, or, in the first case, make sure all libraries use the same
time functions, fix the linux kernel (which might be undesirable), or
know your OS issues and add a millisecond or so, or more. In the case of
libcurl, surely 20ms would not be an issue, and should cover all cases.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the anyevent mailing list