1 |
root |
1.9 |
libev is a high-performanc3 event loop/event model with lots of features. |
2 |
|
|
|
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 |
|
|
|
7 |
|
|
DIFFERENCES AND COMPARISON TO LIBEVENT: |
8 |
root |
1.1 |
|
9 |
root |
1.10 |
(comparisons relative to libevent-1.3e and libev-0.00, see also the benchmark |
10 |
|
|
at http://libev.schmorp.de/bench.html). |
11 |
root |
1.5 |
|
12 |
root |
1.4 |
- multiple watchers can wait for the same event without deregistering others, |
13 |
|
|
both for file descriptors as well as signals. |
14 |
root |
1.2 |
(registering two read events on fd 10 and unregistering one will not |
15 |
root |
1.9 |
break the other). |
16 |
root |
1.2 |
|
17 |
|
|
- fork() is supported and can be handled |
18 |
root |
1.9 |
(there is no way to recover from a fork when libevent is active). |
19 |
root |
1.2 |
|
20 |
root |
1.7 |
- timers are handled as a priority queue (important operations are O(1)) |
21 |
root |
1.9 |
(libevent uses a much less efficient but more complex red-black tree). |
22 |
root |
1.2 |
|
23 |
|
|
- supports absolute (wallclock-based) timers in addition to relative ones, |
24 |
|
|
i.e. can schedule timers to occur after n seconds, or at a specific time. |
25 |
|
|
|
26 |
root |
1.9 |
- timers can be repeating (both absolute and relative ones). |
27 |
root |
1.2 |
|
28 |
|
|
- detects time jumps and adjusts timers |
29 |
root |
1.9 |
(works for both forward and backward time jumps and also for absolute timers). |
30 |
root |
1.2 |
|
31 |
|
|
- can correctly remove timers while executing callbacks |
32 |
root |
1.9 |
(libevent doesn't handle this reliably and can crash). |
33 |
root |
1.2 |
|
34 |
root |
1.3 |
- race-free signal processing |
35 |
root |
1.9 |
(libevent may delay processing signals till after the next event). |
36 |
root |
1.3 |
|
37 |
root |
1.2 |
- less calls to epoll_ctl |
38 |
|
|
(stopping and starting an io watcher between two loop iterations will now |
39 |
root |
1.9 |
result in spuriois epoll_ctl calls). |
40 |
root |
1.2 |
|
41 |
|
|
- usually less calls to gettimeofday and clock_gettime |
42 |
root |
1.9 |
(libevent calls it on every timer event change, libev twice per iteration). |
43 |
root |
1.2 |
|
44 |
|
|
- watchers use less memory |
45 |
root |
1.9 |
(libevent on amd64: 152 bytes, libev: <= 56 bytes). |
46 |
root |
1.2 |
|
47 |
|
|
- library uses less memory |
48 |
|
|
(libevent allocates large data structures wether used or not, libev |
49 |
root |
1.9 |
scales all its data structures dynamically). |
50 |
root |
1.2 |
|
51 |
|
|
- no hardcoded arbitrary limits |
52 |
|
|
(libevent contains an off-by-one bug and sometimes hardcodes a limit of |
53 |
root |
1.9 |
32000 fds). |
54 |
root |
1.2 |
|
55 |
|
|
- libev separates timer, signal and io watchers from each other |
56 |
|
|
(libevent combines them, but with libev you can combine them yourself |
57 |
root |
1.9 |
by reusing the same callback and still save memory). |
58 |
root |
1.2 |
|
59 |
|
|
- simpler design, backends are potentially much simpler |
60 |
|
|
(in libevent, backends have to deal with watchers, thus the problems) |
61 |
root |
1.9 |
(epoll backend in libevent: 366 lines, libev: 90 lines, and more features). |
62 |
root |
1.2 |
|
63 |
root |
1.6 |
- libev handles EBADF gracefully by removing the offending fds. |
64 |
|
|
|
65 |
root |
1.8 |
- doesn't rely on nonportable BSD header files. |
66 |
|
|
|
67 |
root |
1.9 |
- a event.h compatibility header exists, and can be used to run a wide |
68 |
|
|
range of libevent programs unchanged (such as evdns.c). |
69 |
|
|
|
70 |
root |
1.2 |
whats missing? |
71 |
|
|
|
72 |
root |
1.9 |
- evbuffer, evhttp, bufferevent are missing. |
73 |
root |
1.2 |
|
74 |
root |
1.9 |
- no priority support at the moment (but likely to be delivered later). |
75 |
root |
1.2 |
|
76 |
root |
1.9 |
- kqueue, poll (libev currently implements epoll and select). |
77 |
root |
1.4 |
|
78 |
root |
1.9 |
- windows support (whats windows?). |
79 |
root |
1.1 |
|