The events are IO watchers that invoke callbacks. I'm using the hiredis
bindings for Redis (libev adapter here
<https://github.com/redis/hiredis/blob/master/adapters/libev.h>). My
hardware is an ultrabook, i5 processor with four cores. Kernel is
3.13.0-44-generic, Ubuntu 14.04 x86_64. By faster, I mean that when I send
out more events than the system can handle (redis commands), I get 5x more
commands per second with the while loop than with the internally looping
ev_run call. Can you briefly explain why this is the case? The looped
version also consumes 100% CPU since it is an infinite loop, which I want
to avoid by letting libev internally handle the looping. My invocation is
here <https://github.com/hmartiro/redox/blob/master/src/redox.cpp>, line
132, if it matters.

Thank you,
Hayk

On Tue, Jan 20, 2015 at 12:26 AM, Marc Lehmann <schm...@schmorp.de> wrote:

> On Mon, Jan 19, 2015 at 05:33:10PM -0800, Hayk Martirosyan <
> h...@stanford.edu> wrote:
> > I'm using libev in a high-performance application, and I've noticed
> against
> > my expectation that looping ev_run with EVRUN_NOWAIT handles events 5x
> > faster than calling ev_run without the loop. Is this expected behavior?
>
> Depending on how you handle the events, your hardware and your kernel, and
> what you mean by "5x faster" this can well be the case, yes.
>
> --
>                 The choice of a       Deliantra, the free code+content
> MORPG
>       -----==-     _GNU_              http://www.deliantra.net
>       ----==-- _       generation
>       ---==---(_)__  __ ____  __      Marc Lehmann
>       --==---/ / _ \/ // /\ \/ /      schm...@schmorp.de
>       -=====/_/_//_/\_,_/ /_/\_\
>
>
_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to