ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/README
(Generate patch)

Comparing libev/README (file contents):
Revision 1.17 by root, Mon Nov 12 05:40:55 2007 UTC vs.
Revision 1.18 by root, Wed Nov 21 05:05:40 2007 UTC

1Homepage: http://software.schmorp.de/pkg/libev 1libev is a high-performance event loop/event model with lots of features.
2E-Mail: libev@schmorp.de 2(see benchmark at http://libev.schmorp.de/bench.html)
3 3
4libev is a high-performance event loop/event model with lots of features. 4 Homepage: http://software.schmorp.de/pkg/libev
5 E-Mail: libev@lists.schmorp.de
5 6
6It is modelled (very losely) after libevent 7 It is modelled (very losely) after libevent
7(http://monkey.org/~provos/libevent/) and the Event perl module, but aims 8 (http://monkey.org/~provos/libevent/) and the Event perl module, but aims
8to be faster and more correct, and also more featureful. 9 to be faster and more correct, and also more featureful.
9 10
10DIFFERENCES AND COMPARISON TO LIBEVENT: 11ABOUT THIS DISTRIBUTION
11 12
12(comparisons relative to libevent-1.3e and libev-0.00, see also the benchmark 13 If you downloaded a distribution of libev, you will find it looks
13at http://libev.schmorp.de/bench.html). 14 very much like libevent. In fact, the distributed libev tarballs are
15 indeed libevent tarballs patched up with the libev event core, taking
16 the evbuffer, evtag, evdns and evhttpd parts from libevent (they use
17 the libevent emulation inside libev). Configure and Makefile stuff is
18 also a more or less direct copy of libevent, and are maintained by the
19 libevent authors.
14 20
15- multiple watchers can wait for the same event without deregistering others, 21 If you are looking for an easily embeddable version, I recommend using
16 both for file descriptors as well as signals. 22 the CVS repository (linked from the homepage, above), which contains
17 (registering two read events on fd 10 and unregistering one will not 23 only the libev core parts.
18 break the other).
19 24
20- fork() is supported and can be handled 25 Examples of programs that embed libev: the EV perl module,
21 (there is no way to recover from a fork when libevent is active). 26 rxvt-unicode, gvpe (GNU Virtual Private Ethernet) and deliantra
27 (http://www.deliantra.net).
22 28
23- timers are handled as a priority queue (important operations are O(1)) 29DIFFERENCES AND COMPARISON TO LIBEVENT
24 (libevent uses a much less efficient but more complex red-black tree).
25 30
26- supports absolute (wallclock-based) timers in addition to relative ones, 31 The comparisons below are relative to libevent-1.3e.
27 i.e. can schedule timers to occur after n seconds, or at a specific time.
28 32
29- timers can be repeating (both absolute and relative ones). 33 - multiple watchers can wait for the same event without deregistering others,
34 both for file descriptors as well as signals.
35 (registering two read events on fd 10 and unregistering one will not
36 break the other).
30 37
31- detects time jumps and adjusts timers 38 - fork() is supported and can be handled
32 (works for both forward and backward time jumps and also for absolute timers). 39 (there is no way to recover from a fork with libevent).
33 40
34- race-free signal processing 41 - timers are handled as a priority queue (important operations are O(1))
35 (libevent may delay processing signals till after the next event). 42 (libevent uses a much less efficient but more complex red-black tree).
36 43
37- less calls to epoll_ctl 44 - supports absolute (wallclock-based) timers in addition to relative ones,
38 (stopping and starting an io watcher between two loop iterations will now 45 i.e. can schedule timers to occur after n seconds, or at a specific time.
39 result in spuriois epoll_ctl calls).
40 46
41- usually less calls to gettimeofday and clock_gettime 47 - timers can be repeating (both absolute and relative ones).
42 (libevent calls it on every timer event change, libev twice per iteration).
43 48
44- watchers use less memory 49 - absolute timers can have customised rescheduling hooks (suitable for cron-like
45 (libevent on amd64: 152 bytes, libev: <= 56 bytes). 50 applications).
46 51
47- library uses less memory 52 - detects time jumps and adjusts timers
48 (libevent allocates large data structures wether used or not, libev 53 (works for both forward and backward time jumps and also for absolute timers).
49 scales all its data structures dynamically).
50 54
51- no hardcoded arbitrary limits 55 - race-free signal processing
52 (libevent contains an off-by-one bug and sometimes hardcodes a limit of 56 (libevent may delay processing signals till after the next event).
53 32000 fds).
54 57
55- libev separates timer, signal and io watchers from each other 58 - more efficient epoll backend
56 (libevent combines them, but with libev you can combine them yourself 59 (stopping and starting an io watcher between two loop iterations will not
57 by reusing the same callback and still save memory). 60 result in spurious epoll_ctl calls).
58 61
59- simpler design, backends are potentially much simpler 62 - usually less calls to gettimeofday and clock_gettime
60 (in libevent, backends have to deal with watchers, thus the problems) 63 (libevent calls it on every timer event change, libev twice per iteration).
61 (epoll backend in libevent: 366 lines, libev: 90 lines, and more features).
62 64
63- libev handles EBADF gracefully by removing the offending fds. 65 - watchers use less memory
66 (libevent watcher on amd64: 152 bytes, libev native: <= 56 bytes, libevent emulation: 144 bytes).
64 67
65- doesn't rely on nonportable BSD header files. 68 - library uses less memory
69 (libevent allocates large data structures wether used or not, libev
70 scales all its data structures dynamically).
66 71
67- a event.h compatibility header exists, and can be used to run a wide 72 - no hardcoded arbitrary limits
68 range of libevent programs unchanged (such as evdns.c). 73 (libevent contains an off-by-one bug and sometimes hardcodes limits).
69 74
70- win32 compatibility for the core parts. 75 - libev separates timer, signal and io watchers from each other
76 (libevent combines them, but with libev you can combine them yourself
77 by reusing the same callback and still save memory).
71 78
72- the event core library (ev and event layer) compiles and works both as 79 - simpler design, backends are potentially much simpler
73 C and C++. 80 (in libevent, backends have to deal with watchers, thus the problems with
81 wildly different semantics between diferent backends)
82 (epoll backend in libevent: 366 lines no caching, libev: 90 lines full caching).
74 83
75whats missing? 84 - libev handles EBADF gracefully by removing the offending fds.
76 85
86 - libev communicates errors to the callback, libevent to the
87 event adder or not at all.
88
89 - doesn't rely on nonportable BSD header files.
90
91 - an event.h compatibility header exists, and can be used to run a wide
92 range of libevent programs unchanged (such as evdns.c).
93
94 - win32 compatibility for the core parts.
95 (the backend is fd-based as documented and on other platforms,
96 not handle-based like libevent, and can be used for both winscoket environments
97 and unix-like ones).
98
99 - libev can be embedded easily with or without autoconf support into
100 other programs, with no changes to the source code necessary.
101
102 - the event core library (ev and event layer) compiles and works both as
103 C and C++.
104
105 - a simple C++ wrapper that supports methods as callbacks exists.
106
107 - a full featured and widely used perl module is available.
108
109 whats missing?
110
77- no event-like priority support at the moment (the ev priorities 111 - no event-like priority support at the moment (the ev priorities work
78 are not yet finished and work differently, but you can use idle watchers 112 differently, but you can use idle watchers to get a similar effect).
79 to get a similar effect).
80 113
81AUTHOR 114AUTHOR
82 115
83libev was written and designed by Marc Lehmann and Emanuele Giaquinta. 116 libev was written and designed by Marc Lehmann and Emanuele Giaquinta.
84 117
85The following people sent in patches or made other noteworthy 118 The following people sent in patches or made other noteworthy
86contributions (if I forgot to include you, please shout at me, it was an 119 contributions to the design (if I forgot to include you, please shout
87accident): 120 at me, it was an accident):
88 121
89W.C.A. Wijngaards 122 W.C.A. Wijngaards
90Christopher Layne 123 Christopher Layne
91Chris Brody 124 Chris Brody
92 125

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines