1 | libev is a high-performanc3 event loop/event model with lots of features. |
1 | libev is a high-performance event loop/event model with lots of features. |
|
|
2 | (see benchmark at http://libev.schmorp.de/bench.html) |
2 | |
3 | |
3 | It is modelled (very losely) after libevent |
|
|
4 | (http://monkey.org/~provos/libevent/) and the Event perl module, but aims |
|
|
5 | to be faster and more correct, and also more featureful. |
|
|
6 | |
4 | |
7 | DIFFERENCES AND COMPARISON TO LIBEVENT: |
5 | ABOUT |
8 | |
6 | |
9 | (comparisons relative to libevent-1.3e and libev-0.00) |
7 | Homepage: http://software.schmorp.de/pkg/libev |
|
|
8 | Mailinglist: libev@lists.schmorp.de |
|
|
9 | http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev |
|
|
10 | Library Documentation: http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod |
10 | |
11 | |
11 | - multiple watchers can wait for the same event without deregistering others, |
12 | Libev is modelled (very losely) after libevent and the Event perl |
12 | both for file descriptors as well as signals. |
13 | module, but is faster, scales better and is more correct, and also more |
13 | (registering two read events on fd 10 and unregistering one will not |
14 | featureful. And also smaller. Yay. |
14 | break the other). |
|
|
15 | |
15 | |
16 | - fork() is supported and can be handled |
16 | Some of the specialties of libev not commonly found elsewhere are: |
17 | (there is no way to recover from a fork when libevent is active). |
17 | |
|
|
18 | - extensive and detailed, readable documentation (not doxygen garbage). |
|
|
19 | - fully supports fork, can detect fork in various ways and automatically |
|
|
20 | re-arms kernel mechanisms that do not support fork. |
|
|
21 | - highly optimised select, poll, epoll, kqueue and event ports backends. |
|
|
22 | - filesystem object (path) watching (with optional linux inotify support). |
|
|
23 | - wallclock-based times (using absolute time, cron-like). |
|
|
24 | - relative timers/timeouts (handle time jumps). |
|
|
25 | - fast intra-thread communication between multiple |
|
|
26 | event loops (with optional fast linux eventfd backend). |
|
|
27 | - extremely easy to embed. |
|
|
28 | - very small codebase, no bloated library. |
|
|
29 | - fully extensible by being able to plug into the event loop, |
|
|
30 | integrate other event loops, integrate other event loop users. |
|
|
31 | - very little memory use (small watchers, small event loop data). |
|
|
32 | - optional C++ interface allowing method and function callbacks |
|
|
33 | at no extra memory or runtime overhead. |
|
|
34 | - optional Perl interface with similar characteristics (capable |
|
|
35 | of running Glib/Gtk2 on libev, interfaces with Net::SNMP and |
|
|
36 | libadns). |
|
|
37 | - support for other languages (multiple C++ interfaces, D, Ruby, |
|
|
38 | Python) available from third-parties. |
18 | |
39 | |
19 | - timers are handled as a priority queue (important operations are O(1)) |
40 | Examples of programs that embed libev: the EV perl module, |
20 | (libevent uses a much less efficient but more complex red-black tree). |
41 | rxvt-unicode, gvpe (GNU Virtual Private Ethernet), the Deliantra MMORPG |
|
|
42 | server (http://www.deliantra.net/), Rubinius (a next-generation Ruby |
|
|
43 | VM), the Ebb web server, the Rev event toolkit. |
21 | |
44 | |
22 | - supports absolute (wallclock-based) timers in addition to relative ones, |
|
|
23 | i.e. can schedule timers to occur after n seconds, or at a specific time. |
|
|
24 | |
45 | |
25 | - timers can be repeating (both absolute and relative ones). |
46 | CONTRIBUTORS |
26 | |
47 | |
27 | - detects time jumps and adjusts timers |
48 | libev was written and designed by Marc Lehmann and Emanuele Giaquinta. |
28 | (works for both forward and backward time jumps and also for absolute timers). |
|
|
29 | |
49 | |
30 | - can correctly remove timers while executing callbacks |
50 | The following people sent in patches or made other noteworthy |
31 | (libevent doesn't handle this reliably and can crash). |
51 | contributions to the design (for minor patches, see the Changes |
|
|
52 | file. If I forgot to include you, please shout at me, it was an |
|
|
53 | accident): |
32 | |
54 | |
33 | - race-free signal processing |
55 | W.C.A. Wijngaards |
34 | (libevent may delay processing signals till after the next event). |
56 | Christopher Layne |
|
|
57 | Chris Brody |
35 | |
58 | |
36 | - less calls to epoll_ctl |
|
|
37 | (stopping and starting an io watcher between two loop iterations will now |
|
|
38 | result in spuriois epoll_ctl calls). |
|
|
39 | |
|
|
40 | - usually less calls to gettimeofday and clock_gettime |
|
|
41 | (libevent calls it on every timer event change, libev twice per iteration). |
|
|
42 | |
|
|
43 | - watchers use less memory |
|
|
44 | (libevent on amd64: 152 bytes, libev: <= 56 bytes). |
|
|
45 | |
|
|
46 | - library uses less memory |
|
|
47 | (libevent allocates large data structures wether used or not, libev |
|
|
48 | scales all its data structures dynamically). |
|
|
49 | |
|
|
50 | - no hardcoded arbitrary limits |
|
|
51 | (libevent contains an off-by-one bug and sometimes hardcodes a limit of |
|
|
52 | 32000 fds). |
|
|
53 | |
|
|
54 | - libev separates timer, signal and io watchers from each other |
|
|
55 | (libevent combines them, but with libev you can combine them yourself |
|
|
56 | by reusing the same callback and still save memory). |
|
|
57 | |
|
|
58 | - simpler design, backends are potentially much simpler |
|
|
59 | (in libevent, backends have to deal with watchers, thus the problems) |
|
|
60 | (epoll backend in libevent: 366 lines, libev: 90 lines, and more features). |
|
|
61 | |
|
|
62 | - libev handles EBADF gracefully by removing the offending fds. |
|
|
63 | |
|
|
64 | - doesn't rely on nonportable BSD header files. |
|
|
65 | |
|
|
66 | - a event.h compatibility header exists, and can be used to run a wide |
|
|
67 | range of libevent programs unchanged (such as evdns.c). |
|
|
68 | |
|
|
69 | whats missing? |
|
|
70 | |
|
|
71 | - evbuffer, evhttp, bufferevent are missing. |
|
|
72 | |
|
|
73 | - no priority support at the moment (but likely to be delivered later). |
|
|
74 | |
|
|
75 | - kqueue, poll (libev currently implements epoll and select). |
|
|
76 | |
|
|
77 | - windows support (whats windows?). |
|
|
78 | |
|
|