new 4-heap code - please give it a try

Brandon Black blblack at
Wed May 7 18:34:14 CEST 2008

Marc Lehmann wrote:
> I just committed code to use a 4-heap instead of a 2-heap to libev.
> I would be mainly interested in feedback of the type "it doesn't crash"
> or "it seems to work correctly", but wouldn't mind performance numbers,
> either :)
> I'll do some further benchmarks mainly with lower number of watchers, but
> so far, it seems it has no detrimental effect on the performance in that
> case.

I've just tried it against my code, looks pretty good from here.  My 
test suite passes with the new code, so no breakage.

The only performance-sensitive parts of my code that really exercise 
libev only use it for a small handful of watchers for UDP sockets (in 
the benchmark case, 3 UDP sockets).  Even then, the runtime is dominated 
by things other than libev (mostly memory compare/copy operations).

On my dev box (Linux, 1.6Ghz Sempron), I was able to discern a small 
performance difference, but it's near the limit of what I can reliably 
see given the normal random variances in the benchmark runs, so don't 
put too much faith in them.  It definitely didn't seem to hurt though, 
even in my "low number of watchers" case.  These are average seconds for 
the benchmark run (which will generate 1,000,000 socket events on one of 
the three sockets) for the two different versions, using EV_MINIMAL or 
not, sorted by runtime:

3.33 NORMAL: 17.54
3.31 EV_MINIMAL: 17.88
3.33 EV_MINIMAL: 18.49
3.31 NORMAL: 18.49

-- Brandon

More information about the libev mailing list