Psyco works with QNX6 ...

Armin Steinhoff a-steinhoff at web.de
Sun Sep 1 14:56:13 EDT 2002


Hello,

 'Psyco' works also with QNX6!! See the performance tests below ....

# Python program without Psyco:
def hanoi(n):
        han_move("a", "c", "b", n)

def han_move(frm, to, also, n):
        if (n < 2):
                return frm, to
        else:
                return han_move(frm, also, to, n - 1), \
                                han_move(frm, to, also, 1), \
                                han_move(also, to, frm, n - 1)

i = 0
while i<10000:
        hanoi (8)
        i = i+1

# time python hanoi.py
   19.10s real    18.92s user     0.00s system
                  ^^^^^
----------------------------------------------------------------------------------------------------
# Python program with PSYCO:

#import the specialization compiler
import psyco   

def hanoi(n):
        han_move("a", "c", "b", n)

def han_move(frm, to, also, n):
        if (n < 2):
                return frm, to
        else:
                return han_move(frm, also, to, n - 1), \
                                han_move(frm, to, also, 1), \
                                han_move(also, to, frm, n - 1)

# specialize han_move
psyco.bind(han_move)

i = 0
while i<10000:
        hanoi (8)
        i = i+1

RESULT:

# time python psy_hanoi.py
    2.17s real     1.87s user     0.02s system
                   ^^^^
Python + PSYCO is 10 times FASTER !  Its nearly C speed ...


Regards

Armin



More information about the Python-list mailing list