joyent/libuv — pull request #1123 by saghul (2014-02-17 20:23:25+00:00)
Title: unix: use a heap for timers

> Replace the red-black tree with a heap. The most common operation that
libuv performs on timers is looking up the first timer to expire. With
a red-black tree, that operation is O(log n). With a heap, it's O(1).

This work was done by @bnoordhuis a while ago. I talked with him and the code is ready to be merged. While there might be room for more optimizations when using millions of timers, the common use cases are already better with this.

This patch is a squash and rebase of https://github.com/joyent/libuv/pull/928

@bnoordhuis: does heap-inl.h need to be listed in Makefile.am and uv.gyp? It didn't complain here, but we seem to list all internal include files.