On Fri, Jan 21, 2000 at 03:59:27PM +0100, [EMAIL PROTECTED] wrote:
> > Creating a watcher is
> > relatively heavy weight. Being able to reuse watchers for different
> > fds is a useful option.
>
> This is interesting. I immediately validated this by a test script, and the
> (statistic) result was that reusing safes more than half of the time (related to
> starting a new one).
>
> Well, this means I will start to implement a pool of predeclared watchers which
> can be used in the server to accelerate it. Or would it be a better idea to
> having this managed by Event which already knows all necessary internals and data
> structures? I could imagine an interface like this:
>
> # enable the pool feature for certain watcher types
> @Event::pool{qw(io)}=();
>
> # start a watcher as usual ...
> Event->io(...);
>
> # cancel the watcher, but store it in the pool
> # (this should automatically reinit specific data)
> $watcher->recycle;
>
> # now, a new watcher installation as usual ...
> Event->io(...);
I bet most of the time is spent processing the constructor. That's what
might be worth avoiding. If my speculation is correct then Event
probably can't help since it doesn't know which parts of the
initialization it can skip.
--
"Never ascribe to malice that which can be explained by stupidity."
via, but not speaking for Deutsche Bank