I have a few issues with the way the benchmarks are run, and then some actual useful comments. :)

time(1) includes Perl & Python startup/shutdown time, which may be significant.

Your times seem to be wall clock based, which can vary based on system load, network conditions, and so on. Show the CPU times instead.

It appears that you've only run one iteration. Benchmarks should be run enough times to account for statistical variance.

Ok, that said:

A deep and accurate answer requires a deep knowledge of all technologies involved. I'm not familiar with Python and Twisted, so I can't make a good comparison by myself.

A previous reply on this thread suggested that CORE::select() was taking the most time, which strongly implies that POE spends more time waiting for network activity than Twisted does.

If that's the case, it may be that POE may be checking for I/O faster than Twisted, and therefore more often, which could result in more and smaller reads from the socket. The overhead per read will be higher, although the reads will be more timely.

Someone with dual Perl/Python and POE/Twisted experience would be best to dig into this to find the actual cause. We can then act on that, rather than on conjecture.

Since the cause is likely to be within POE's implementation, we have room for improvement. For example, it's been suggested on irc.perl.org #poe to make POE's I/O events latency tunable. An interactive application might choose better responsiveness, while a bulk transfer application (such as yours?) could be tuned for higher throughput. It's an interesting idea, but I don't have resources to pursue it. If someone else does, I'll be happy to provide advice and guidance, here, in private e-mail, or on IRC.

--
Rocco Caputo - [email protected]



On Mar 23, 2009, at 07:18, howard chen wrote:

I have 2 simple scripts which connect to NNTP server to fetch 100
articles (no writing to local disk) in order to test the performance
of two frameworks.

I have found Twisted is faster by at least 2 times which make me surprised.

I know it is not fair to compare two frameworks by this simple test.
But I think 2 times is quite much.

Therefore, I upload the code online to see if any experts can find any problem?


Thanks.

http://howachen.googlepages.com/nntp.py
http://howachen.googlepages.com/nntp.pl


time python nntp.py news.microsoft.com microsoft.public.access access.mbox

18 sec

time perl nntp.pl

37 sec


Any comments?

Reply via email to