Upcoming POE Changes

Rocco Caputo <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
[This is a repost of http://use.perl.org/~rcaputo/journal/39736]

Those of you who use POE for serious things should be aware of a  
couple changes introduced after 1.269.
First, here's a public service annoucement from POE: Developers who  
want to keep up with POE's latest changes are encouraged to follow its  
repository. You'll get instant notification of changes as often as  
you'd like, and you'll have maximum lead time to report new bugs or  
port production code to new features. I've also released Version  
1.269_002 to the CPAN for developers who are more comfortable with  
that. Remember: CPAN shells don't install developer releases by  
default. And now back to the changes!

Synchronous I/O Dispatch

POE::Kernel dispatches I/O events synchronously after 1.269.  
Previously these events would be enqueued along with everything else,  
only to be dequeued and dispatched as soon as possible. Now they're  
dispatched as they happen, saving the overhead of a round trip through  
the event queue. Developers should notice an improvement in I/O bound  
programs.

This naturally changes the timing of I/O events. Where in the past  
they may have been enqueued behind other events, they now come first.  
This could cause problems for users who depend on the relative timing  
of I/O events compared to other kinds of events. I expect most  
developers won't notice the difference.

This optimization is most effective for code that uses POE::Kernel's  
select_read() and select_write() watchers directly. Additional layers  
of abstraction, such as POE::Component::Server::TCP or AnyEvent add  
overhead that has not been reduced by this optimization.

Mark and Sweep Session Garbage Collection

Session termination and memory reclamation have been combined and  
delayed. Combining them reduces the overhead of POE::Kernel's  
dispatcher by eliminating a few method calls per event. Delaying  
garbage collection allows POE to do this work when it's likely to be  
idle anyway. While the latter optimization doesn't reduce CPU  
consumption, it should reduce callback latency in the common case.

People who require _stop to be called immediately when a session  
releases its last resource may be disappointed. _stop events are  
dispatched as a side effect of garbage collection, which as I've  
mentioned has been delayed. Adam Kennedy's Test::POE::Stopping has  
been affected. I hope his is a special case.

More to Come

There will be more improvements in the future, but that's all for now.  
Stay tuned, and please report any problems you encounter early and  
often. Thanks!

-- 
Rocco Caputo - [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.