Hello,
reading this thread, I found that
> 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(...);
# but because io pools are active and there is a
# recycled watcher in the pool, Event will automagically
# use the watcher in the pool
There could also be a class method to fill a pool by a number of predeclared
watchers.
Just an idea ...
Greetings
Jochen