On Thu, Mar 22, 2001 at 10:31:55AM -0800, Rob Bloodgood wrote:
> I'm curious,
> should I be using C<Event> in my program(s)?
>
> I can't find any specifics on yes or no, only that POE supports it.  From
> what I've gleaned about POE's operation, the most complex part of it is
> state management/context switching.  Since Event (task switching, async
> looping) is written in C, does that imply that my program will run faster
> simply by using Event?

I think Event gives you two benefits over POE's own select loop:

1. Safe signals.  Event polls for signals in C, bypassing Perl's
problematic signal handlers and the coredumps they can cause.

2. Interoperability with other modules using Event.

POE with Event generally seems a little slower.  It makes some sense,
since POE's record-keeping overhead is roughly constant both ways.
Frobbing Event in addition to that is extra work.

Here are benchmarks run on an Athlon 1GHz, using POE 0.1206 and Event
0.81.  I think the differences between figures are wider on slower
machines.  Anyone who wants to try the benchmark program on their own
systems should mail me off-list, and I'll pass along a copy.

eyrie:/usr/home/troc/perl/misc$ ./bench.perl
Using POE's select loop...
   500000 posts                in    33.057 seconds (  15125.362 per second)
   500000 dispatches           in   106.736 seconds (   4684.451 per second)
   300000 alarms               in    26.264 seconds (  11422.307 per second)
   100000 alarm_adds           in    51.414 seconds (   1944.996 per second)
   100000 alarm_clears         in     3.855 seconds (  25941.804 per second)
   100000 session creates      in    36.550 seconds (   2736.014 per second)
   100000 session destroys     in    96.578 seconds (   1035.436 per second)
   100000 select toggles       in    25.488 seconds (   3923.346 per second)
  1000000 calls                in    22.905 seconds (  43658.855 per second)
   200000 single_posts         in    32.030 seconds (   6244.179 per second)
      100 startups             in    32.529 seconds (      3.074 per second)
--- times ---
wall :   467.992
user :   415.070  cuser:    29.984
sys  :    14.992  csys :     2.047

eyrie:/usr/home/troc/perl/misc$ ./bench.perl event
Using Event...
   500000 posts                in    33.365 seconds (  14985.728 per second)
   500000 dispatches           in   106.031 seconds (   4715.597 per second)
   300000 alarms               in    26.838 seconds (  11178.158 per second)
   100000 alarm_adds           in    52.419 seconds (   1907.700 per second)
   100000 alarm_clears         in     3.917 seconds (  25530.844 per second)
   100000 session creates      in    36.620 seconds (   2730.728 per second)
   100000 session destroys     in    96.144 seconds (   1040.104 per second)
   100000 select toggles       in    26.035 seconds (   3841.018 per second)
  1000000 calls                in    23.077 seconds (  43332.370 per second)
   200000 single_posts         in    32.997 seconds (   6061.075 per second)
      100 startups             in    33.612 seconds (      2.975 per second)
--- times ---
wall :   471.835
user :   415.758  cuser:    30.062
sys  :    15.258  csys :     2.203

-- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sourceforge.net

Reply via email to