--- AnyEvent/lib/AnyEvent.pm 2008/04/25 13:51:32 1.85 +++ AnyEvent/lib/AnyEvent.pm 2008/04/25 14:24:29 1.90 @@ -966,17 +966,16 @@ natively. The pure perl implementation is hit in a few sweet spots (both the -zero timeout and the use of a single fd hit optimisations in the perl -interpreter and the backend itself, and all watchers become ready at the -same time). Nevertheless this shows that it adds very little overhead in -itself. Like any select-based backend its performance becomes really bad -with lots of file descriptors (and few of them active), of course, but -this was not subject of this benchmark. +constant timeout and the use of a single fd hit optimisations in the perl +interpreter and the backend itself). Nevertheless this shows that it +adds very little overhead in itself. Like any select-based backend its +performance becomes really bad with lots of file descriptors (and few of +them active), of course, but this was not subject of this benchmark. -The C module has a relatively high setup and callback invocation cost, -but overall scores on the third place. +The C module has a relatively high setup and callback invocation +cost, but overall scores in on the third place. -C's memory usage is quite a bit bit higher, but it features a +C's memory usage is quite a bit higher, but it features a faster callback invocation and overall ends up in the same class as C. However, Glib scales extremely badly, doubling the number of watchers increases the processing time by more than a factor of four, @@ -989,14 +988,16 @@ precedence over speed. Nevertheless, its performance is surprising, as the file descriptor is dup()ed for each watcher. This shows that the dup() employed by some adaptors is not a big performance issue (it does incur a -hidden memory cost inside the kernel, though, that is not reflected in the -figures above). +hidden memory cost inside the kernel which is not reflected in the figures +above). -C, regardless of underlying event loop (wether using its pure perl -select-based backend or the Event module) shows abysmal performance and -memory usage: Watchers use almost 30 times as much memory as EV watchers, -and 10 times as much memory as both Event or EV via AnyEvent. Watcher -invocation is almost 900 times slower than with AnyEvent's pure perl +C, regardless of underlying event loop (whether using its pure +perl select-based backend or the Event module, the POE-EV backend +couldn't be tested because it wasn't working) shows abysmal performance +and memory usage: Watchers use almost 30 times as much memory as +EV watchers, and 10 times as much memory as Event (the high memory +requirements are caused by requiring a session for each watcher). Watcher +invocation speed is almost 900 times slower than with AnyEvent's pure perl implementation. The design of the POE adaptor class in AnyEvent can not really account for this, as session creation overhead is small compared to execution of the state machine, which is coded pretty optimally within @@ -1004,16 +1005,21 @@ =head2 Summary -Using EV through AnyEvent is faster than any other event loop, but most -event loops have acceptable performance with or without AnyEvent. +=over 4 -The overhead AnyEvent adds is usually much smaller than the overhead of -the actual event loop, only with extremely fast event loops such as the EV +=item * Using EV through AnyEvent is faster than any other event loop +(even when used without AnyEvent), but most event loops have acceptable +performance with or without AnyEvent. + +=item * The overhead AnyEvent adds is usually much smaller than the overhead of +the actual event loop, only with extremely fast event loops such as EV adds AnyEvent significant overhead. -And you should simply avoid POE like the plague if you want performance or +=item * You should avoid POE like the plague if you want performance or reasonable memory usage. +=back + =head1 FORK