[Twisted-Python] twisted 30% slower than asyncore?

Anthony Baxter anthony at interlink.com.au
Thu May 1 01:18:58 EDT 2003


>>> Itamar Shtull-Trauring wrote
> We'll see what we can do to improve this (if we can, and when we have
> time :).

If it helps, I have slabs of hotshot data on this. The top 10 (from 20,000
small HTTP fetches:

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    20082   50.981    0.003  172.623    0.009 default.py:418(doSelect)
    60024   26.018    0.000   26.018    0.000 tcp.py:116(writeSomeData)
    40022   22.463    0.001   24.738    0.001 failure.py:91(__init__)
   488147   21.022    0.000   24.747    0.000 <string>:1(fileno)
    20010    4.160    0.000    4.932    0.000 tcp.py:209(createInternetSocket)
    60024    3.486    0.000    6.361    0.000 tcp.py:97(doRead)
    60030    2.795    0.000    2.795    0.000 default.py:489(addReader)
    40020    2.789    0.000    3.782    0.000 tcp.py:90(__init__)
    40020    2.746    0.000   47.347    0.001 tcp.py:232(doConnect)
    20010    2.573    0.000    4.484    0.000 abstract.py:87(doWrite)

That 'failure.py' is looking like some tasty low-hanging fruit to me,
but doSelect should be amenable to some speedups as well...

I should probably add that even though Twisted is slower than asyncore,
pythondirector using Twisted is still 10-15% faster than the written-in-C 
"Pound" load balancer, and about 5% slower than the "balance" load balancer
(also in C).

Anthony

-- 
Anthony Baxter     <anthony at interlink.com.au>   
It's never too late to have a happy childhood.





More information about the Twisted-Python mailing list