Re: Why POE is slower then Python - Twisted ... quite a lot?

Martijn van Beers <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
On Tue, 2009-03-24 at 10:05 +0900, Daisuke Maki wrote:
> I'm going to take a wild guess here: POE::Component::Pluggable.

Nope, that isn't it. I would have found that surprising anyway, since
there aren't any plugins being used, so it's just a few checks if there
are any plugins. (I checked by disabling the plugin handling)

I thought maybe it had something to do with twisted running a more
efficient loop by default, so I tried with some alternate loops (EV,
POE::Loop::XS::EPoll), but that doesn't make much of a difference either

Then I thought maybe it's the fact that Client::NNTP uses Filter::Line,
so there's an event dispatched for each line of message instead of just
one per message. While hacking up Client::NNTP to use Filter::Stream
instead reduced the number of _invoke_state calls from almost 6000 to
slightly over a thousand, that still only shaves off a few seconds of
runtime.

Devel::NYTProf says most of the time is being spent in CORE::select in
loop_do_timeslice for the select loop or in EV::loop() for the EV loop
(and not much difference between the two). I'm not an expert on POE
internals, nor familiar with Twisted, so I can't say if it's just
because Twisted does less than POE, or that there's something that could
be optimised.


Martijn
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.