ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent.pm (file contents):
Revision 1.91 by root, Sat Apr 26 02:27:30 2008 UTC vs.
Revision 1.95 by root, Sat Apr 26 11:06:45 2008 UTC

959can never compete with an event loop that uses epoll when the number of 959can never compete with an event loop that uses epoll when the number of
960file descriptors grows high. In this benchmark, all events become ready at 960file descriptors grows high. In this benchmark, all events become ready at
961the same time, so select/poll-based implementations get an unnatural speed 961the same time, so select/poll-based implementations get an unnatural speed
962boost. 962boost.
963 963
964Also, note that the number of watchers usually has a nonlinear effect on
965overall speed, that is, creating twice as many watchers doesn't take twice
966the time - usually it takes longer. This puts event loops tested with a
967higher number of watchers at a disadvantage.
968
964C<EV> is the sole leader regarding speed and memory use, which are both 969C<EV> is the sole leader regarding speed and memory use, which are both
965maximal/minimal, respectively. Even when going through AnyEvent, it uses 970maximal/minimal, respectively. Even when going through AnyEvent, it uses
966far less memory than any other event loop and is still faster than Event 971far less memory than any other event loop and is still faster than Event
967natively. 972natively.
968 973
1035timeout is reset each time something is read because that reflects how 1040timeout is reset each time something is read because that reflects how
1036most timeouts work (and puts extra pressure on the event loops). 1041most timeouts work (and puts extra pressure on the event loops).
1037 1042
1038In this benchmark, we use 10000 socketpairs (20000 sockets), of which 100 1043In this benchmark, we use 10000 socketpairs (20000 sockets), of which 100
1039(1%) are active. This mirrors the activity of large servers with many 1044(1%) are active. This mirrors the activity of large servers with many
1040connections, most of which are idle during at any one point in time. 1045connections, most of which are idle at any one point in time.
1041 1046
1042Source code for this benchmark is found as F<eg/bench2> in the AnyEvent 1047Source code for this benchmark is found as F<eg/bench2> in the AnyEvent
1043distribution. 1048distribution.
1044 1049
1045=head3 Explanation of the columns 1050=head3 Explanation of the columns
1046 1051
1047I<sockets> is the number of sockets, and twice the number of "servers" (as 1052I<sockets> is the number of sockets, and twice the number of "servers" (as
1048eahc server has a read and write socket end). 1053each server has a read and write socket end).
1049 1054
1050I<create> is the time it takes to create a socketpair (which is 1055I<create> is the time it takes to create a socketpair (which is
1051nontrivial) and two watchers: an I/O watcher and a timeout watcher. 1056nontrivial) and two watchers: an I/O watcher and a timeout watcher.
1052 1057
1053I<request>, the most important value, is the time it takes to handle a 1058I<request>, the most important value, is the time it takes to handle a
1054single "request", that is, reading the token from the pipe and forwarding 1059single "request", that is, reading the token from the pipe and forwarding
1055it to another server. This includes deleteing the old timeout and creating 1060it to another server. This includes deleting the old timeout and creating
1056a new one with a later timeout. 1061a new one that moves the timeout into the future.
1057 1062
1058=head3 Results 1063=head3 Results
1059 1064
1060 name sockets create request 1065 name sockets create request
1061 EV 20000 69.01 11.16 1066 EV 20000 69.01 11.16

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines