[Twisted-Python] Performance footprint of the twisted.internet.task

Andy Leszczynski leszczynscy at yahoo.com
Wed Jan 25 16:37:35 EST 2006


Hi,

I have three programs which do nothing besides a
certain function/code line is executed approximately
100 times a second. Not big deal it would seem.

1:
from twisted.internet import task
from twisted.internet import reactor

def runEverySecond():
    pass

l=task.LoopingCall(runEverySecond)
l.start(0.01)
reactor.run()


2:
import time

while 1:
    #f()
    time.sleep(0.01)

3:
from twisted.internet import reactor

def f(p):
    reactor.callLater(0.01,f,0)

f(0)

reactor.run()


* * *

I use version 1.3 of twisted on to of the python 2.3
and run it on Windows XP. Interestingly when executing
second and third snippet the CPU utilization is not
impacted while the first program leaves python taking
minimal but visible 1-2% of CPU.

Does anybody have any idea why it would take place?

Thx,
AndyL






More information about the Twisted-Python mailing list