[Twisted-Python] Psyco is our friend

Psyco == http://sf.net/projects/psyco/ So, I ran a Banana benchmark, attached. The results: Psyco on 1.8585100174 seconds (5380.65434483 messages a second) Now I edit the file and turn off psyco: Psyco off 4.81016397476 seconds (2078.93120743 messages a second) Nice, eh? import time, psyco from twisted.spread import banana PSYCO = 1 if PSYCO: psyco.bind(banana.encode) psyco.bind(banana.int2b128) psyco.bind(banana.b1282int) psyco.bind(banana.decode) psyco.bind(banana.Banana.dataReceived) psyco.bind(banana.Banana._encode) s = banana.encode([1, 2, "hello", "there"]) banana.decode(s) if PSYCO: print "Psyco on" else: print "Psyco off" # run the actual benchmark start = time.time() for i in xrange(10000): s = banana.encode([i, i*2, "hello", "there"]) banana.decode(s) elapsed = time.time() - start print elapsed, "seconds (%s messages a second)" % (10000 / elapsed)
participants (1)
-
Itamar Shtull-Trauring