new 4-heap code - please give it a try

Marc Lehmann schmorp at
Thu May 8 22:59:33 CEST 2008

On Wed, May 07, 2008 at 11:34:14AM -0500, Brandon Black <blblack at> wrote:
> I've just tried it against my code, looks pretty good from here.  My 
> test suite passes with the new code, so no breakage.

Yeah, and my test suite passed as well, the problem showed only with few
timers :-<

> 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).

Hopefully. My designs usually try to optimise basic parts as much as
possible (or sensible), so I can waste all that nice speed with slower
perl code or so :)

> 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.33 EV_MINIMAL: 18.49

> 3.31 NORMAL: 18.49
> 3.31 EV_MINIMAL: 17.88

Thats interesting, especially that the MINIMAL timing and the 3.31 normal
timings agree so much.

But then if minimal on 3.31 makes such a large difference, it should make
a similar difference on 3.33. So I guess stuff like cache colouring is
really responsible for the difference.

Still, the small number of timers case is not unimportant, at least it
shows that in typical programs the difference isn't great.

So your numbers are reassuring (I hope the bug didn't change the numbers
much :)

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      pcg at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list