Hi! The next release of AnyEvent contains support for a few more "backends", notably POE, so AnyEvent is now by definition compatible to POE (before it was only compatible when using an even loop used by POE, such as Event or EV that could be shared). To get a feeling about the overheads imposed by the extra layer of AnyEvent and especially of the performance of the POE backend (which is severely limited by a number of design problems in POE), I made some benchmarks. I started with benchmarking watcher creation/destruction time and callback invocation time. The results were mostly as expected, with EV leading and POE being abysmal. The surprising one was the pure perl implementation, which was quite on par with C-based event loops such as Event or Glib. I did expect the pure perl implementatioon to be at least a factor of three slower than Event or Glib. As the pure perl loop wasn't written with high performance in mind, this prompted me to optimise it for some important cases (mostly to get rid of the O(n²) degenerate cases and improving the select bitmask parsing for the sparse case). I then made a second benchmark, designed not to measure anyevent overhead, but to measure real-world performance of a socket server. The result is that the pure perl event loop used as fallback in AnyEvent single-handedly beats Glib by a large margin, and even event by a factor of two. For small servers, the overhead introduced by running a lot of perl opcodes per iteration dominates, however, reflected in the last benchmark. However, the net result is that the pure perl event loop performs better than almost all other event loops (EV being the only exception) ins erious/medium-sized cases, while I originally expected it to fail completely w.r.t. performance and being only usable as a workaround when no "better" event module is installed. All the benchmark data and explanations can be found here: http://pod.tst.eu/http://cvs.schmorp.de/AnyEvent/lib/AnyEvent.pm#BENCHMARKS The code is not yet released and likely still buggy (the question is whether any bugs affect the benchmark results). It is only available via CVS: http://software.schmorp.de/pkg/AnyEvent Of course, I am very pleased by the performance of perl 5.10 in particular and perl in general. This case also shows that one can beat C code in many important cases by using better algorithms (i.e. by writing it the "perlish" way). It also means one can write medium-sized servers without relying on any XS modules for performance, and that AnyEvent adds no serious overhead to programs. Feedback would be appreciated, otherwise: enjoy :) -- The choice of a Deliantra, the free code+content MORPG -----==- _GNU_ http://www.deliantra.net ----==-- _ generation ---==---(_)__ __ ____ __ Marc Lehmann --==---/ / _ \/ // /\ \/ / pcg@goof.com -=====/_/_//_/\_,_/ /_/\_\Thread Next