Coro benchmarks ?

Zsbán Ambrus ambrus at math.bme.hu
Mon May 2 00:17:40 CEST 2011


On Sun, May 1, 2011 at 3:24 PM, Przemyslaw Iskra <sparky at pld-linux.org> wrote:
> On Sat, Apr 30, 2011 at 06:20:42AM +0200, Marc Lehmann wrote:
>> If you want to make it utmost efficient, you can always add, say, an XS
>> interface to EV with fallback to plain AE.
>
> The nice thing about EV that AE does not have is that I can register a
> socket for both reading and writing and it tells me which of those
> happened. I haven't seen libcurl yet to require both at once, but it
> could do it, so I have to account for such possibility and it somewhat
> complicates the design.

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
SOCKETFUNCTION handler of the curl object would be a C function that
starts an ev io watcher, and when this ev io watcher is called, its
action is a C function that calls curl_multi_socket_action (resp to
the timer), all without having to run perl code or touching any perl
data structure.

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
looked at its source code yet.

Ambrus



More information about the anyevent mailing list